LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I extract a dates column from an ascii file

I am extracting data from an ascii file and the rest of the data is extracted using read from spreadsheet, but the date appears as just the day e.g. 22 for 22nd, how can I get the date, format in ascii is e.g 22/04/2006, can I do this by specifying something at format of read from spreadsheet ? Cheers
 
Emily
0 Kudos
Message 1 of 3
(2,714 Views)
In an ascii file, the data are stored as string data. It's up to the programmer to interpret them as numbers or date or whatever you want...
The "read from spreadsheet"vi interprets the data as single precision numbers (3 decimal places as default), and accordingly, there is no way to read a date with it.
The only thing you can do is to read the entire file as strings and create your own interpretor.
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 3
(2,701 Views)
Hi,
 
I found the other day that there are instructions included inside the Read From Spreadsheet vi on how to modify it slightly to read strings rather than doubles.
 
If you drop the Read From Spreadsheet  vi onto the block diagram and double click on it, you will open the front panel for the vi. If you then select the block diagram (for Read From Spreadsheet) you will see an 'instructions' frame below the main 'code', and the 3rd paragraph tells you how to modify the VI to read the spreadsheet as a set of strings rather then doubles. Save the vi as a new filename when you've edited it or you will overwrite the existing vi!
 
Using the newly modified vi you can read in your entire spreadsheet, extract the dates as strings, then do any conversion necessary to the other columns of the sheet to change them into the types of value you require (eg doubles).
 
I hope this helps.
 
Mark
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(2,691 Views)