LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple columns with uneven rows

Good Evening Everybody

 

Could somebody advise me on the best solution to do the following.

 

I have a csv file. The csv file is being read using "read from spreadsheet file" vi.

 

The file contains multiple columns. The columns all have a different last row address. By this I mean that...say...the last row of column 1 is 5. Column 2 last row is 23, Column 3 last row is 12. etc. The file might look like the following...note...this is an example of a file only, and any implications can't be construed.

 

            Column1    Column2    Column3    Column4     Column5

Row1        0               1                 2             3                 4

Row2       12             23              13            34                 0
Row3       11             44              23                               11

Row4       34             55            

Row5       21           

 

Lets assume that the value(s) of interest are contained in columns 2,4 and 5. Therefore the values I want to extract would be 55, 34 and 11

 

I can select the columns of interest fine, but am having difficulty working out how to find the last row for these columns

 

Caveats:

1. The number of columns changes

2. Position of column in file changes address...never found in same address

 

Does anybody know how I might be able to locate the last row in the column of my choosing.

 

Thanks for any assistance.

 

best regards

Ray

0 Kudos
Message 1 of 3
(2,421 Views)

Hi Ray,

 

load the csv as an array of strings. Empty cells will result in empty strings. So you can easily test each column for an empty item, which will mark the "End of Data"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(2,413 Views)

Thanks GerdW

 

It was that simple

 

I'm constantly surprised at how seemingly difficult problems can be reduced down to some insignificant LV code.

 

I want to be a LV knight too, when I grow up.

 

kudo to you

 

Ray

0 Kudos
Message 3 of 3
(2,368 Views)