09-28-2005 06:42 PM
09-29-2005 11:50 AM
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
09-29-2005 12:20 PM
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