LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Beginner] Plotting 2D array on a XY graph

As a good beginner I’m trying to read data from an ASCII file (2 columns) and plot them using an XY graph. For this I’m using the "read from spreadsheet file" VI option. The main problem is that the output is a 2D array and for this reason I’m not able to connect it to a XY graph. I found an old answer that explain one way to do it (splitting the arrays and bundle them for input to the XY graph) as can be seem below.

“Drop an index node and grow it to have two index terminals for 2D arrays. Popup on one of the terminals and choose to disable it. This will index out a 1D array instead of a single element. Wire a constant, 0 or 1, to the other terminal. If you are slicing the array the wrong way, sw
ap the constant and the disabled terminal. Once you have two arrays, bundle them and wire to the graph. If you have other data to plot, make an array of the clusters.”

Direct to the point: What exactly means “index node“? I tried to find something similar trough the XY Graph examples but until now I couldn’t find a function that behaves in this way. Does someone have an idea about which function can be?

Thank you in advance

Rodolfo
0 Kudos
Message 1 of 5
(4,487 Views)
If you are using LabVIEW 6, you just have to wire a 2D array to the Index Array function. Only in earlier versions of LabVIEW do you have to grow it by using the pointer tool and making the function larger. In either case and assuming that your x values are in one column and the y values are in another, use two of the Index Array functions to get each column. Wire a constant of zero to the bottom input of one to extract the first column of data and wire a constant of one to the bottom input of the other function in order to extract the second column. In LabVIEW 5, you'll also have to disable indexing of the first Index Array input and enable indexing for the input you wire your constant too. You do this by moving the pointer over the input and right cli
cking the mouse. Good luck.
Message 2 of 5
(4,487 Views)
Thank you Dennis for your answer and also for including information about other LV versions'.
I’m using version 6. I increased the “Index Array “ until I have two sub arrays and I added only a constant “0” on the first “index (col)” The other “index (col)” I left blank and the program worked good as well.
Anyway, to add a constant ”1” to the second index looks as a guarantee that in another occasion I’ll not be any strange XY Graph...

Rodolfo
0 Kudos
Message 5 of 5
(4,487 Views)
I think it is the "Index Array" Function in the Array Palette.

Dave.
0 Kudos
Message 3 of 5
(4,487 Views)
Yes, "Index Array" worked very well.
Now I have an XY Graph (and it looks fine for me)

Thank you Dave.

Rodolfo
0 Kudos
Message 4 of 5
(4,487 Views)