Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting double array into CNiReal64Vector

I'm retriving my saved data in a double array. I can't use a for loop and equate each array element to a CNiReal64Vector as there will be errors.
Is there any way of converting the a double or int array into a format that can be plotted by CNiGraph::PlotY?
I'm using Visual C++.
0 Kudos
Message 1 of 2
(3,066 Views)
The easiest way to do this would be to create a CNiReal64Vector in-place in your call to PlotY. Since you are passing an array of doubles, you want to call the CNiReal64Vector constructor that has the number of elements and double * as parameters. The code would look something like the following.

int numPoints = 1000;
double dataArray[1000];
GetData(dataArray);
m_graph.PlotY(CNiReal64Vector(numPoints, dataArray));

You should be able to use the approach you originally tried. What errors were you getting when trying to populate the CNiReal64Vector in your loop? Did you set the size of the CNiReal64Vector to the size of your data array?

David Rohacek
National Instruments
Message 2 of 2
(3,066 Views)