LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XYZ coordinates to matrices?

Solved!
Go to solution

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.

0 Kudos
Message 1 of 17
(6,481 Views)

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

Message 2 of 17
(6,466 Views)

What goes into the 2D Z array?  The z coordinates along with what else?

0 Kudos
Message 3 of 17
(6,463 Views)

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.

0 Kudos
Message 4 of 17
(6,450 Views)

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?

0 Kudos
Message 5 of 17
(6,433 Views)

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.

Jesse S.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 17
(6,407 Views)

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

Message 7 of 17
(6,403 Views)

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.

0 Kudos
Message 8 of 17
(6,390 Views)

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.

0 Kudos
Message 9 of 17
(6,385 Views)

All of the x and y values are integers.  Does that mean I can disregard that step?

0 Kudos
Message 10 of 17
(6,382 Views)