02-23-2018 08:05 AM
You can feed an XY Graph two different ways.
Option one:
Option two:
If you need more help with this, share your code so we can see where you're having trouble.
02-23-2018 08:14 AM
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
02-23-2018 08:55 AM
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.
02-23-2018 10:13 AM
@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):
02-23-2018 11:56 AM
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'.
02-23-2018 12:00 PM
02-23-2018 12:02 PM
Thanks Ben! The x value is wavelength not time.
02-23-2018 12:02 PM - edited 02-23-2018 12:46 PM
@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'.
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.
02-23-2018 12:59 PM
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.
02-23-2018 01:37 PM
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.
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.