LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read columns from spreadsheet?

I have text based spreadsheet files containing several columns of data (previously collected data written to file by "write to spreadsheet file" function). Each column is separated by a tab character.

I need to plot each column on a separate waveform chart. I am trying to use the "read data from spreadsheet" function to do this, which I understand reads in the spreadsheet file as a 2D array.

I cannot figure out how to separate each column from the 2D array which is the output of the "read data from spreadsheet" function. For each column in the spreadsheet, I need a 2D array, the first row of which is a series of numbers (1, 2, 3, 4, 5, 6 etc) representing arbitrary time points, and the second row is the act
ual data from ONE column of the spreadsheet. I could then wire this 2D array to a waveform chart. I would need a separate 2D array for each column in the spreadsheet.

Could someone suggest how this can be done? Better yet, is there example code available somewhere that shows how to do it?

Thanks.
0 Kudos
Message 1 of 4
(4,044 Views)
Using read from spreadsheet vi, you can read rows, but if you select Transpose array terminal as true, you'll get columns in rows. This way and using index array vi, selecting the row you want and leaving the other input as indexing enabled you can get 1D arrays for each initial column, then you canwire them to a waveform chart.
Hope this helps
0 Kudos
Message 2 of 4
(4,044 Views)
Array indexing in LabVIEW version 6i can be confusing.

I include an example code that you can study to see how it is done in your case.

Basically, you need to disable the row index when using the ArrayIndex function. In earlier versions of LabVIEW this was done by right clicking on the index-input and selecting disable/enable input but with the new version this is no longer needed. Just wire what you have and the other port will be disabled automatically. However, if you are using version 6i, make sure you wire the array to the ArrayIndex first. You should then get a 2D version of the Indexing function automatically. In older versions you had to manually drag it to a bigger dimension. Attached are two files. One data file, data.txt, with three rows and three co
lumns, and one VI, ColumnIndexing.vi, that reads out a specific column from that text file.

This example code is compatible with LabVIEW 4.1 and up.

Hope this helps. /Mikael
Download All
0 Kudos
Message 3 of 4
(4,044 Views)
Hello Gorka...
I think i am having the same problem as JNR.
But I would like to display the data in certain column in Excel, extract it and display onto the XY graph.
I have problem with data separated from different index on the array. File attached. Please show me.
Many thanks.
0 Kudos
Message 4 of 4
(4,044 Views)