Tags: avoid, forced, fromstring, labview, programming, reading, scan, stringswhenever, timestamp, working
Reading in a timestamp
Thanks for the quick help. I really avoid working with strings
whenever possible, but now I'm being forced to. I tried the Scan From
String with the format you suggested, and I kept getting an error ("too
many format specifiers"). I'm attaching a vi with what I'm doing.
you (or anyone) has a chance to look at it, I would love any more
Leave a comment...
- 3 Comments
- You get the message "too many format specifiers" because you used the format
string I told you, but with only one output.
You need 6 outputs if you're reading six parts (mm DD YYYY HH MM SS.s).
Of course, that won't work either if you put in a string that starts out "Lo
You probably should read the file with "%s" format, and get an array of
Throw away the first line of commentary stuff.
Strip out the first column.
For every row in the first column, run the string through the SCAN FROM STRI
NG function, and maybe the DATE/TIME to SECONDS function to get a timestamp
Then run the rest thru a STRING TO NUMBER conversion (no loops needed) to ge
t your data.
HTH#1; Sun, 18 May 2008 21:08:00 GMT
- Forgot to mention, use
as your scan string, and it will output a timestamp.#2; Sun, 18 May 2008 21:09:00 GMT
- You're only getting a 2 because you're using read from spreadsheet file and
returning doubles. When the timestamp string gets converted to a double, it
sees "02/..." It doesn't know how to convert a slash into a double so it ass
umes the number ends there.
I suggest you wire a %s to Read from Spreadsheet File. This will give you al
l the data in strings. Now you can take out the first column and convert it
to timestamps (using Scan from String), then take out all the actual data an
d convert it to doubles.Mes
sage Edited by Marc A on 03-01-2007 11:20 AM#3; Sun, 18 May 2008 21:10:00 GMT