From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to read and parse a .CSV file.

I have what I hope it is not a unique problem. I want to read and parse a .CSV file. The file is large and the first two rows are data type string
and the third column is also of data type string all the rest of the columns and rows are of data type double. I want to do is make the first to
rows of the .CSV file the header of an .XLS file and the the third column in the .CSV file the first column in the .XLS file. The remaining data
is to be used for calculations.  I have used the 'Read From Spreadsheet' function to read the file but the string data are rendered zero when 
double type read is selected and vice versa for string type read with the doubles. Can anyone provide some insight on how to make this happen??
I am under the gun to perform data analysis for a study I am conducting and the previous analysis code leaves a bit to be desired.
Any help will be greatly appreciated.
 
Thanks everyone,
  Vincent
0 Kudos
Message 1 of 5
(7,318 Views)


Vincent wrote:
I have used the 'Read From Spreadsheet' function to read the file but the string data are rendered zero when 
double type read is selected and vice versa for string type read with the doubles.

If string is selected, use "Decimal string to number" to convert the strings to numbers.
You should post a small file, with a simple vi, if you have further problems.
What you are trying to do is quite trivial
0 Kudos
Message 2 of 5
(7,313 Views)

You may find it more straight forward to read the CSV file as text (Read from Text File) and then manipulate the data as you see fit.  You can convert each line to an array of strings using 'Scan String for Tokens' or the OpenG VI 'String to 1D Array' or similar techniques.  This should get the data (as strings) into a 2D array which you can convert and manipulate at will.

Hope this helps.

----------------------------------
LabVIEW 8.0.1; WinDoze XP
aut viam inveniam aut faciam
0 Kudos
Message 3 of 5
(7,305 Views)

Anyone has a example for this?

 

Tks!

0 Kudos
Message 4 of 5
(6,525 Views)

alinecfadel wrote:

Anyone has a example for this?

 

Tks!


 

duplicate post
0 Kudos
Message 5 of 5
(6,517 Views)