Hi Ignacio,
The Variant returned inside ScaledData is stored as a 2-D array internally when you sample multiple channels, or a 1-D array if you sample a single channel.
If you want to get the array(s) inside it into VC++, I'd suggest you construct a CNiReal64Matrix (2-D) or a CNiReal64Vector (1-D) as follows:
void CContDAQDlg::OnAcquiredDataCwai1(VARIANT FAR* ScaledData, VARIANT FAR* BinaryCodes)
{
CNiReal64Matrix wave(ScaledData); // constructs a 64-bit floating point 2-D array
m_graph.PlotY(wave); // plot the data in the CWGraph
}
You can do this because the constructors of CNiReal64Matrix and CNiReal64Vector can take Variants and extract the array(s) from it into a new variable, in this case "wave".
To get the data for individual chann
els, you can extract the 1-D arrays inside it. Keep in mind that the data for channel one is stored in the first column of the 2-D array, the data for channel two is stored in the second column, and so on.
Another tip: To index the CNiReal64Matrix variable "wave", you need to use parentheses. For example to get the element in the first row and first column of the 2-D matrix, you need to write:
float myval = wave(0,0); // indexing wave at row 0, column 0
Hope this helps,
Azucena Perez
National Instruments