LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get specific range of data from csv file

Hello

i have a CSV file that im importing with a read delimiter spreadsheet 

the file contains more than 100 rows and 6 columns and i want to access every row 4, 5, and 6 cols.

its all in numbers and no string involved 

how can i do this?

thanks

 

0 Kudos
Message 1 of 6
(1,514 Views)

 

  1. Read the entire file into a numeric Array 
  2. Index the rows/columns you are interested in out of the Array
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 6
(1,503 Views)

hello 

i understand the idea but i don't know how to do it

i used index array and tried to set the indexes of each row and column by using a for loop but it didn't work.

0 Kudos
Message 3 of 6
(1,498 Views)

@DMR12 wrote:

hello 

i understand the idea but i don't know how to do it

i used index array and tried to set the indexes of each row and column by using a for loop but it didn't work.


Well without seeing your code all I can says is, you are doing it wrong...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 6
(1,492 Views)

A CSV file is nothing by one long string. In order to get numbers, you need to parse it and LabVIEW has all the tools you need for that. Seems you are unsig read from spreadsheet file and that's not the problem. Are the number floating point or integers?

 

This leaves us with a smallish 2D array that you want to process in some way, but it is not clear at all.

 

What do you mean by "access"? That's a very ambiguous term! If you just want the 2D array containing only rows 4,5,6, you don't even need a loop.

 


@DMR12 wrote:

i used index array and tried to set the indexes of each row and column by using a for loop but it didn't work.


There a millions of ways something does not work and probably hundreds of ways where it works perfectly. You are not really narrowing down the problem. Typically you would auto-index the full array, then get the three column elements, either with index array resized to three output, or as a subset with three element. Again, it all depends what you mean by "access".

 

To get help, do the following two things:

 

  1. Exactly define what you are trying to do.
  2. Attach your failed attempt, preferably not in the newest LabVIEW version. Make sure we have a typical array, e.g. as diagram constant.

 

0 Kudos
Message 5 of 6
(1,468 Views)

You should explore the 'Read Delimited Spreadsheet.vi' that is built into LabVIEW.

data csv.png

 

0 Kudos
Message 6 of 6
(1,432 Views)