LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What VI can I use to generate an intensity plot of scattered data?

I have some sparse data that is not equally spaced in the X and Y plane that I need to plot.  I do not want to use a 3D surface plot to display this data.  The data is stored in a 2D array that contains 3 columns.  An example is shown below:

+---------------------------------+
|     X    |    Y     | Intensity |
+---------------------------------+
|    5.2   |    -2.5  |    101.2  |
|    4.1   |   -12.1  |    141.2  |
|    7.4   |   -47.2  |    171.2  |
|    1.9   |   241.1  |    121.2  |
|   11.6   |    32.5  |    155.2  |
|  101.5   |    72.3  |     10.2  |
|   22.1   |    91.2  |     65.2  |
|  -34.2   |    -3.4  |     88.2  |
|   55.2   |   -13.9  |    202.2  |
|    5.2   |   -52.8  |     45.2  |
|    5.2   |   102.3  |     33.2  |
+---------------------------------+
 
I need a VI that takes as an input a 2D array of doubles (like the one shown above) and outputs an Intensity Plot.  Where can I get a VI like this?  Matlab has this kind of plotting capability but I cannot install Matlab on every machine that will be using my LabVIEW software.
 
Thanks,
Richard Ballantyne
 
0 Kudos
Message 1 of 5
(2,897 Views)
Why dont you want to use a 3D surface?
 
I have never used the intensity graph, but by looking at the help, it takes as input an array of Z values where the indices are x and y values.
Do you have a maximum precision for x and y values?
 
For example:
your x and y values go to 1 decimal place, so multiply all values by 10 and convert to integer,
initialize a 2d array with a size equal to the max values for X and Y (this will have be changed slightly since you have negative values).
Initialize that array to NaN values
loop through your Z values, and use replace array subset to insert each data point at the corresponding x and y indices.
send this array to a intensity graph.
 
or, use a 3D surface and lock it so the user can't rotate it? 
Jeff


Using Labview 7 Express
0 Kudos
Message 2 of 5
(2,872 Views)
Hi jrpe,
 
Thank you for your clever suggestions.  I did what you said and it works pretty well.  I had to write some code to automatically determine the X and Y spacing so that I could set the size of the 2D Intensity Plot array correctly.  That code needs a little polishing but otherwise it works.  I've attached the code to this post.  Feel free to use, distribute, modify in any way you want.
 
Cheers,
Richard Ballantyne
 
0 Kudos
Message 3 of 5
(2,863 Views)
Can you add some reasonable real data as default into your input array and attach the VI once more?
 
The first loop is seriously flawed, because it will run forever in the input array is empty. Not good! 🙂
0 Kudos
Message 4 of 5
(2,859 Views)

Like I said, the code needed a little polishing.  Here is a more "idiot proof" version:

 

0 Kudos
Message 5 of 5
(2,846 Views)