From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

I use the CNiReal64Matrix with the function PlotXvsY and I allways get a Line in the 0 yaxis value on the graph,why?

I use the CNiGraph from Measurment studio for visual c++.
0 Kudos
Message 1 of 5
(3,032 Views)
Could you please post some sample code that demonstrates how you get this result? Thanks.

- Elton
0 Kudos
Message 2 of 5
(3,032 Views)
I attached sample code,
I hope you'll be able to help me.

Thank's Lino.
0 Kudos
Message 3 of 5
(3,032 Views)
Your code is calling CNiReal64Matrix::SetSize(unsigned int rows, unsigned int cols, NiMatrixAutoInit initializeData = NiMatrixInit), which resizes the matrix to the specified dimensions and zeros out the data. If you're seeing an additional line at 0 in the graph, it's because a row in your matrix still contains the default 0 data because it's not getting populated with data. I suggest looking a little closer at this part of the code:

YdataMtx.SetSize((LU_Id.GetCount()),ObjList.GetCount());
XdataPtr.SetSize(0);
for(i = 0;i < ObjList.GetCount();i ++)
{
tmp = ObjList.GetPrev(ObjPosition);
XdataPtr.Append(tmp.Timecode);
j = (LU_Id.MyFind(tmp.Obj_Id));

YdataMtx(j,i) = tmp.R
ange;
}

It's probably either adding one more row than what's needed in the YdataMtx.SetSize call, or the for loop is not iterating for each row that was allocated in the matrix.

- Elton
0 Kudos
Message 4 of 5
(3,032 Views)
I checked it out, it's not it.

Furthermore, I tried to draw a line in the 0 Yaxis in the graph (with some color I choose) and the graph "ignored" it and draw the same line as before.

I attached code.

Thank's Lino
0 Kudos
Message 5 of 5
(3,032 Views)