LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Import values from CSV with FOR loop

Solved!
Go to solution

Good afternoon,

 

I am new to LabView, and am trying to write a VI that will eventually run a set of calculations on a data set with several millions of data points. I want the VI to count the number of data points imported from the .CSV file as they are written into an array. The number of points will eventually help me to determine the end behavior of my calculations, so it's not optional.

 

I am having trouble getting the file to read each successive row. The "For Loop Iteration" value is feeding into the "Start of Read Offset" of "Read From Spreadsheet File.vi" . My intention was that this would result in a new row being read into the array with each iteration of the loop. What I'm getting is the first value read over and over again into the first row of the array. Any ideas?

 

Thanks for your time and help,

Wes

0 Kudos
Message 1 of 5
(3,383 Views)

Why not just use the Read from Spreadsheet to read the whole file at once. Why read it a line at a time? If they file is extremely large you can read it in chunks but reading it line by line is not very efficient.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 5
(3,376 Views)

I'm reading it one line at a time so that the loop iteration will increment with each line, giving me the sample size.

Is there a more efficient way of counting how many data points are imported? I wasn't able to find another way...

 

 

0 Kudos
Message 3 of 5
(3,374 Views)
Solution
Accepted by topic author JWTyler

@JWTyler wrote:

I'm reading it one line at a time so that the loop iteration will increment with each line, giving me the sample size.

Is there a more efficient way of counting how many data points are imported? I wasn't able to find another way...

 

 


There is a nice VI called "Array SIze" that will also do that for you.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(3,372 Views)

Wow. Alright.

I'm not sure how I missed that one...

 

Thanks for the help!

0 Kudos
Message 5 of 5
(3,370 Views)