LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY graph display uncertain number lines.

You can feed an XY Graph two different ways.

 

Option one:

  1. Bundle each X,Y pair into a cluster (one point)
  2. Build an array of points (one plot)
  3. Bundle each plot into a cluster by itself
  4. Build an array of these clusterized plots

Option two:

  1. For each plot make two identically-sized arrays, one of X values and one of the corresponding Y values
  2. Bundle those two arrays into a cluster (one plot)
  3. Bundle each plot into a cluster by itself
  4. Build an array of these clusterized plots

If you need more help with this, share your code so we can see where you're having trouble.

0 Kudos
Message 11 of 21
(1,690 Views)

If the "X" values are time then you can use a Waveform data type such that the "T0" values are the time.

 

There is also a variation on this that comes with the sound a vibration stuff that uses the frequency as if it is T0.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 21
(1,687 Views)

Oops, I just realized you can omit step 3 of Option 2, the cluster of X and Y arrays can be built directly into an array and doesn't need to be put into another cluster by itself.

0 Kudos
Message 13 of 21
(1,683 Views)

@M.Mei wrote:

The x value is from the instrument and the number of plots is not fixed. I got an array(the dimension is typed by users ) as output from an instrument, now I want to display these lines (the first dimension is the x value, and y values respond the remaining dimension). I am very sorry I still do not know how to begin this vi, so I cannot upload a sample...


OK, so you have a 1D array of x values of size N and a 2D array of Y data with N columns and M rows (or vice versa. M=number of plots, which is variable).

 

So all you need is the following (If the Y values are arranged as rows instead of columns, omit the transpose, so modify as needed):

 

MultiXY.png

Message 14 of 21
(1,678 Views)

Thanks altenbach! My input is a bit different from your example. Your vi makes me think about this sub-vi. By this vi, it only can display and save one line at one time. Can you please help me how to revise this vi to display and save multi lines once? The 'array in' is my input, the 'array out' is the output linked the xy graph, and the number is typed by users and it is the reason why I say 'uncertain'.

front panel.JPGback panel.JPG

0 Kudos
Message 15 of 21
(1,670 Views)

Thanks arteitle! But I think my problem is I even do not know how to separate the input... I am a bit confused with the data transmission. I post a sub-vi, and if possible, can you please help me on that?

0 Kudos
Message 16 of 21
(1,666 Views)

Thanks Ben! The x value is wavelength not time.

0 Kudos
Message 17 of 21
(1,665 Views)

@M.Mei wrote:

Thanks altenbach! My input is a bit different from your example. Your vi makes me think about this sub-vi. By this vi, it only can display and save one line at one time. Can you please help me how to revise this vi to display and save multi lines once? The 'array in' is my input, the 'array out' is the output linked the xy graph, and the number is typed by users and it is the reason why I say 'uncertain'.

front panel.JPGback panel.JPG


Please attach your VI (or a simplified version) with some typical data. You seem to have a 3D array (why???), so what are the meanings of the various dimensions and where is the x array located?

 

In any case, your "build array" and shift register is unnecessary. You could as well autoindex at the output tunnel to get the exact same 2D array. Try it. Simplify!

 

Also, since you index out the first dimension wired to [i], you could autoindex at the input tunnel of the 3D array, eliminating getting the size and wiring N.

 

 

0 Kudos
Message 18 of 21
(1,664 Views)

To be honest, this is the first time I know the data is a 3D array....  'Accumulation' means how many times to repeat the detection( I do not know why this parameter appears here), 'Number' corresponds to the number typed in by users,  e.g. in the vi, if you type in '5', then the number 5 line will display in the graph, rather than 5 lines.  'wavelength' is the x label.The data comes from the detection directly, and until now I do not know how to save this 3D array data... The instrument is a spectrometer from JY.

output.JPG

0 Kudos
Message 19 of 21
(1,653 Views)

OK, as a first step you need to familiarize yourself with arrays in LabVIEW. If you did not even know that you had a 3D array, that's not very promising. Is it possible you are accidentally inserting a "built array" or extra "autoidexing" somewhere upstream? Can you show us the upstream code?

 

For example here are two alternative codes that do exactly the same as your picture earlier, but with much less code (see also my signature!)

 

Just FYI, this is probably not the solution to your problem.

 

ArraySlicing.png

 

One of your dimension is size 1, so maybe you are really only dealing with a 2D array. If not, please attach a VI that has default data in all three dimensions.

 


@M.Mei wrote:

 'Number' corresponds to the number typed in by users,  e.g. in the vi, if you type in '5', then the number 5 line will display in the graph, rather than 5 lines.
 

Well, earlier you wanted to display multiple plots, so to select multiple plot, maybe you want an array of numbers, one for each plot. Or you could use a boolean array with one switch for each plot and the user can select which one to graph by turning them on/off. Learn about conditional tunnels for an efficient way to do that! (Of course you could just blindly always graph all and use the visibility checkbox to hide some of them).

 

Frankly, You should explain your problem a little better. Why not attach a VI that contains typical data in a control AND the xy graph AND the plot selector for multiple plots. Then tell us how the graph should look like.

0 Kudos
Message 20 of 21
(1,648 Views)