LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from spreadsheet and plot to graph

I have 2 column data represent amplitude and time. My ideas is to read the data from text file and plot it to waveform graph. I have a problem where i cannot plot the whole data to the graph. 

 

Can someone check my code.

Thank you in advance.

Download All
0 Kudos
Message 1 of 5
(2,871 Views)

crossposted on LAVA


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,851 Views)

Not everyone who reads the Forum is on LAVA, so I'll answer here.

 

Your data are not a Waveform (which has only a Y array, with the time element implicitly represented by t0 and dt).  You, instead, have time (X) explicitly represented, so you want to plot X vs Y, and hence want an XY Graph.

 

Now you'll see another (minor) problem -- Plot Graph wants a cluster consisting of the array of X points and the array of Y points.  The spreadsheet has X as the first column.  If you use Index Array to pull out the columns, you'll need to wire 0 and 1 to the column inputs.  If you don't wire anything into the index inputs of Index Array, it will return the first row, not column.  If you want to use the feature of "pulling down" a second output and want to export rows, simply take the transpose of the 2D array from Read from Spreadsheet.

Plot XY Graph.png

Bob Schor

0 Kudos
Message 3 of 5
(2,838 Views)
A normal graph can be used by simply subtracting row 0, column 0 from row 1, column 0 to get the dt that the graph needs.
0 Kudos
Message 4 of 5
(2,819 Views)

Read from Spreadsheet File has an input called Transpose.  It defaults to False.  Wire a true constant to that and the 2-D array comes out already transposed.

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