LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CA_VariantSet2DArray Anomaly

Solved!
Go to solution

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.

0 Kudos
Message 1 of 3
(2,998 Views)
Solution
Accepted by topic author Scott_T

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).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(2,988 Views)

Thanks for the explanation. I can see the pattern in the resultant graph.

 

Scott T. 

0 Kudos
Message 3 of 3
(2,968 Views)