07-31-2013 08:48 PM
I'm trying to make a contour plot. Right now I have three 1d arrays containing x, y and z coordinates. The 3D contour VI option in labview requires an x, y and z matrix, each 2D. I'm not sure how to go about this. Thanks.
Solved! Go to Solution.
07-31-2013 09:20 PM
Try using the "vector" version of the Plot Contour VI which requires a 1D array for the X and Y "vectors" and a 2D array for the Z "matrix".
07-31-2013 09:21 PM
What goes into the 2D Z array? The z coordinates along with what else?
07-31-2013 09:31 PM
It's the Z values for the combination of points that are defined by the X and Y 1-D arrays.
Open up the detailed help file on the VI. There is an example accessible from that help file.
07-31-2013 10:24 PM
I'm still confused. I have a 1d array of a cluster of 3 elements, is there any way to unbundle them into 1d arrays and build a z matrix?
08-01-2013 11:43 AM
chazzchuzz,
What you are inputting into that function is your x values and your y values and a z array. Now picture the z 2-D array as a map that is the size of your x vector by the size of your y vector. Each of those positions is going to have a z-value associated with it. If you want to plot just points individually, you would want to use the scatter plot where the z input is just a vector. I hope this helps.
08-01-2013 11:55 AM
@chazzchuzz wrote:
I'm still confused. I have a 1d array of a cluster of 3 elements, is there any way to unbundle them into 1d arrays and build a z matrix?
Do the X and Y values map to a regular grid? In this case you would initialize a 2D array of the correct size and keep it is a shift register of a FOR loop. Loop over all xyz clusters using autoindexing, inside the loop, unbundle x,y,z, map the x and y values to integer indices basd on x0, y0 and dx, dy, and use "replace array subset" to substitute the Z value at the derived indices. The output of the shift register will have your 2D Z array.
See how far you get....
08-01-2013 04:41 PM
I follow up until the 'map the x and y values to integer indices based on x0,y0 and dy, dx' step. Not quite sure what that involves. Thanks for the help.
08-01-2013 04:47 PM
Well, are the x and y values always simple integers (0,1,2,3,4,5....) or something else (e.g. 0.3, 0.5, 0.7, 0.9, ...)?
Array indices are always integers starting with zero, so if you have something else, you need to decide how to translate real x and y values to the corresponding array indices of the 2D array.
08-01-2013 04:51 PM
All of the x and y values are integers. Does that mean I can disregard that step?