04-25-2012 12:52 PM
Using CVI version 8.0.1 and calling the following prior to plotting a 3D graph:
int rowSize = 41;
int columnSize = 65;
double bMatrix[200][200];
CA_VariantSet2DArray(&bVariant, CAVT_DOUBLE, rowSize, columnSize, &bMatrix);
If I declare bMatrix[200][65] everything works fine.
If I declare bMatrix[200][200] the plot is totally wrong.
Is there a reason the second dim of bMatrix must be declared to the exact data size, whereas the first dim does not?
The goal is to pass 2D data of varying sizes to CA_VariantSet2DArray().
Using CW3DGraphLib_CWPlot3DPlot3DSurface to plot the actual graph.
Any insights are appreciated,
Scott T.
Solved! Go to Solution.
04-26-2012 06:06 AM
I seem to remember that VariantSet2DArray wants memory to be in a single, continuous block. If you use the right value for the second array index, single lines will be contiguous; if the second dimension is wider than the space you need, the part of the matrix that contains useful data will not be contiguous, as memory is organized by lines (that is bMatrix[0][0], bMatrix[0][1]... bMatrix[0][199], bMatrix[1][0], bMatrix[1][1] ... bMatrix[1][199] and so on).
04-26-2012 05:04 PM
Thanks for the explanation. I can see the pattern in the resultant graph.
Scott T.