LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Do the X and Y number of data points parameters work correctly in PlotIntensity?

in CVI 7.0, I get confusing results from PlotIntensity() if the X_DATA_POINTS, Y_DATA_POINTS parameters are not the same as the 2D z axis data array size.  I would like to set the starting point and range of such a plot as one might if this was a normal graph.  If these parameters match the z array size, the plot looks ok, but if I make them smaller (zoom), the plot looks strange.  Is it because of the 2D array arrangement?  How can I get around this problem if my number of data points do not match up with statically dimensioned 2D array?   The array is large (~300 X ~500)
thanks
0 Kudos
Message 1 of 3
(3,403 Views)

I suspect that the problems you are having have to do with the 2D nature of arrays in C. Keep in mind that a 2D array is a somewhat artificial construct, that is exists only for ease of indexing. Internally, it is nothing but a big, flat continuous chunk of 1-dimensional memory. So, in your case, imagine that you have the following 2D array, represented by X's:

                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                               XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Now, imagine that you want to zoom into a portion of that array, represented by the bold X's above. The problem is that that portion of the array does not occupy a contiguous chunk of memory, and therefore the PlotIntensity function cannot treat it as such. I imagine that you are passing the address of the first bold X as your base address (&data[3][7]) and you are then passing xSize = 12, ySize = 4. However, the function is still expecting 4 adjacent rows of 12 values each, and that is not what is in the array that you are passing it. What is in the array is a row of 12 values, followed by 19 elements that should be skipped, followed by 12 more values, and so on...

The only way you could zoom into it would be if each row were complete. You could skip some rows at the beginning, and some rows at the end, but you could not skip any columns.

 Hope this helps.

Luis
NI

Message 2 of 3
(3,391 Views)

ok, I see what you are saying.  I will recreate the array with the appropriate values, then pass the new dimensions.

thanks for the help

0 Kudos
Message 3 of 3
(3,387 Views)