05-14-2015 10:15 AM
I need to get my formatted time stamp (which includes down to the millisecond) into a double format. I've been using scan from string. No matter what formatting I use, the double number is always truncated and only displays a reolution of a tenth of a second.
I need my date/time string in DBL format becuase I need to append it to an array of other DBL numbers which is being written to a .csv file. So it can't be in string format (unless theres some way to write both to a .csv file)
What can I do to get the respresentaion correct?
Solved! Go to Solution.
05-14-2015 10:20 AM
in your example, there is no reason to even go to a string. Just use the To Double coercion node.
I'll try to play around with this to see if I can find something with the string formatting.
05-14-2015 10:22 AM
THanks criossrulz, you're right, I just used a to double conversion node/.
Problem solved, my issue is that in my write to spreadsheet file vi, I had the wrong formatting parameter.
05-14-2015 10:24 AM - edited 05-14-2015 10:25 AM
Not sure why you are converting to a string and then a double.
Why not covert to a double then format the double as a string?
Guess I was to slow... Thats what happens when you get old...
05-14-2015 10:42 AM
I need it as a double because I need to append it to an array of DBL which is being written to a .csv file.
And I need the date/time stamp in the format I specified. WHen I convert the string to double, it loses its resolution (which is down to 1e-6 seconds) see below.
05-14-2015 10:47 AM
I actually can't just coerce to double because I need the timestamp formatted in the way I specified in "format date/time string"
05-14-2015 10:49 AM
@Snow_In_Tehran wrote:
I need it as a double because I need to append it to an array of DBL which is being written to a .csv file.
And I need the date/time stamp in the format I specified. WHen I convert the string to double, it loses its resolution (which is down to 1e-6 seconds) see below.
You just have a display issue here. Change the data format of your numeric to be floating point with a high number of digits of precision and you will see that your data is there.
05-14-2015 11:02 AM
Thanks, that takes care of displaying it on the front panel. However, how to I get it so that such a representation is passed out of the function to I can write it to my data file?
The DBL that it outputs is still only to a tenth of a second format.
05-14-2015 11:07 AM
@Snow_In_Tehran wrote:
Thanks, that takes care of displaying it on the front panel. However, how to I get it so that such a representation is passed out of the function to I can write it to my data file?
The DBL that it outputs is still only to a tenth of a second format.
Well that completely depends on the format string you are using for when you are creating your CSV. You probably want something like "%.6f" for you format.
05-14-2015 11:29 AM
I've tried that and every type of formatting and it still gives me that precision.
Interestingly, when I do %f.6 as opposed to %.6f, I get the resolution. However, there is a .6 appended to every number in the data file! Any idea how I can get that out? Now I'm getting the precision I want but have that weird character in there.