LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write the time stamp to a excel file

Dear all superusers,
The title imply my question that is how to store every time stamp obtained to an excel file.  But when open the file, it contains nothing. Could someone help on this matter.
Regards,
Lee Joon Teow
Electronic Test Engineer Smiley Very Happy
0 Kudos
Message 1 of 11
(5,210 Views)
Hi LJ,

can you define "excel file" more precisely?!?

Do you need:
- a raw txt file
- csv-formatted data
- a xls file (Excel's proprietary format)

You also don't mention what you have done so far. Which file functions diud you use? Did you use ActiveX to control Excel? Can you attach a vi that shows your problems ("it contains nothing")?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(5,204 Views)

Dear GedW,

I need to store it as a csv file :-). Thanks.

 

Best Regards,

LJ Teow

0 Kudos
Message 3 of 11
(5,180 Views)
Hi LJ,

here's an example for writing timestamp to Excel-compatible csv file...

The details of the calculation are given here!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(5,169 Views)

How accurate do you need your timestamp? The LabVIEW timestamp has 128 bits of resolution. Converting it to a double throws away 74 bits of this. In practical terms, an absolute timestamp goes from a resolution of about 10-19s to a resolution of about 10-6s. For most applications, this is OK. If you need the extra resolution, let us know. I have some code buried on my hard drive somewhere that converts the timestamp to a full-resolution ASCII string. This could be used as a starting point to produce something Excel can read with higher resolution, although if you need this type of resolution in Excel, you will need to use relative timestamps.

0 Kudos
Message 5 of 11
(5,158 Views)

Dear GerdW,

I have tried the it but it gives me slightly different results on the year, that is instead of 2008 this gives me 2000.

The attached is as below,

 

 

Thanks.

Dear FGray,

Thank you for taking your time to reply me. Is there any other way to solve this? I need more idea :-).

Best Regards,

LJ

 

0 Kudos
Message 6 of 11
(5,145 Views)
Hi LJ,

change the subtract to an add operation. Sorry, my fault.

Where are your attachments?


Message Edited by GerdW on 03-19-2008 03:12 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(5,141 Views)
Dear GerdW,
Forgot to attached Smiley Happy
Here is the attached. The From Excel file to Time Stamp, I have accidentally closed it without saving.
 
Best Regards,
Lee Joon
0 Kudos
Message 8 of 11
(5,137 Views)

Dear GerdW,

I have another one for you. See attached, it works after change to add. Have a happy easter!

Best Regards,

LJ

0 Kudos
Message 9 of 11
(5,134 Views)
The other method involved a lot of low-level bit manipulation.  Start by typecasting the timestamp to a cluster of 1 I32 and 3 U32s (alternately 1 I64 and 1 U64).  The timestamp is signed; thus the use of a signed integer for the higher order bits.  Then generate the ASCII directly from these integers (not trivial).  The biggest problem with this approach is that Excel cannot really read the result - it has too many digits, so Excel truncates it to something it can read.  I believe you can get the same result by coercing the timestamp to an extended precision double, then converting to ASCII.  Use the offsets and scaling mentioned earlier in the post to convert from LabVIEW seconds to Excel days.
0 Kudos
Message 10 of 11
(5,103 Views)