LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

transforming semicolon delimited file into numerical data

Solved!
Go to solution

Slightly strange request, but as I'm stuck, here we go:

 

I've got a seemingly .csv file that I want to load into LabVIEW2010. The simple "%.;%f" code doesn't work as it can't read the file itself (see attached). I managed to read in the file by using the "read from text file" function which gives me the multi-column data in a string. 

 

I want to divide the data into an numerical array so I can start to use and analyse it. Any suggestions how?

 

Many thanks!

 

Patrick

0 Kudos
Message 1 of 5
(2,576 Views)
Solution
Accepted by topic author Paddy1985

Hi Patrick

 

I stated by converting the text string to a spreatsheet array of strings then isolating the string array containing the raw data for Acc X, Acc Y, Acc Z, Qua x, Qua y, Qua z Qua w. and thus converting all of that to an array of doubles.

 

If you wish to use the time stamps for your analysis you should do some manipulation to that string column aswell I did not do anything to it since there is not a consistent interval between each timestamp however either way you choose to use it it should be fairly simple to convert that aswell.

 

I have attached my solution in the zip hope it helps you along 🙂

 

/Sletten

Message 2 of 5
(2,554 Views)

GE_NI_US!

 

Superb! Can't believe I didn't think of that myself!

 

Thanks dude!

0 Kudos
Message 3 of 5
(2,550 Views)

The VI can be simplified considerably:

  • Wiring a length is not necessary.  The Array Subset function will automatically return the rest of the array past the index.
  • The 2 loops are not necessary. The string conversion functions are polymorphic.

 

 

Note: If you only interested in the numerical values, then you can replace the Read From Text File and Spreadsheet String to Array with the single Read From Spreadsheet File VI.

Message 4 of 5
(2,545 Views)

Cheers for the post Smercurio

 

I Have not used the array subset function that much and the convert string to value is usually reverted in my code ;). Again Kudos for the updated information.

 

/Sletten

 

 

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