LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Measurement File Express VI - Time information

I need some assistance with a small problem with building reports of collected data. I don't see it very relevant, but I'm collecting data from several modules on a 9074 cRIO. I'm not using the cRIO the way it is intended, but it is perfect for my needs. Anyway, I'm collecting the different types of data in RT, then using the express VI "Write to Measurement File" with TDMS option selected and one time column only selected. Also one header, etc. Nothing fancy.

 

In another VI I want to use this collection of .tdms files to create an Excel report. Everything is working good however I need a time column for reporting my data. When I view the .tdms file using Excel Importer, the time column is there and perfect, with the next column a relative time (or iteration) and then columns with the signal names at top and all the data below. Perfect.

 

I'm similarly using the "Read from Measurement File" Express VI to get the data back the same way it went in. I have everything in it's correct place on building the Excel Report, but I haven't been able to find any way to include the first time column in my import. I can use "Get Attributes" Express VI to get the signal names from the read, but that's not going to help with the time data. How is it possible that Labview allows to put the time data there, but not retrieve it? I'm aware of the warnings that Timestamps aren't supported by TDMS file format vs LVM, but there MUST be a way to retrieve that time information if "Excel Importer" can do it.

 

If that time column in the TDMS file is somehow computed using the start timestamp and dt, can someone explain how to compute that for my report?

 

Unfortunately, I can't use the LVM format because I need to allow the users of these VI's the backup of using Excel Importer to see this data if my report generation VI is not functional.

 

I'll attach one of the TDMS files for illustration. The first column of the second worksheet is exactly the data I need for my report.

0 Kudos
Message 1 of 6
(3,637 Views)

Hi AWyers,

 

Are you familiar with the TDMS VI's? You can use these VI's by going to the Functions Palette>>Programming>>FIle IO>>TDMS Streaming.

 

The TDMS file contains the Start Time under the Property: NI-ExpStartTimeStamp which has the start timestamp along with the Property: wf_increment which you can use as the dt. You can get these values by using the TDMS Get Properties VI.

 

DylanC

0 Kudos
Message 2 of 6
(3,612 Views)

DylanC,

 

I'm familiar with TDMS VI's. I'm using them to write and get the information I need, including the Get Properties VI. I thought there might be a way to use the StartTimeStamp property along with the dt, however sometimes there are differences in the sample rate of a few milliseconds. In the TDMS file, when imported into Excel, you can see these differences, yet the dt value is 1.0000 seconds. How can these exact sample times be computed? If I had an array of dt values from one sample to another it would be easily implemented, but to my knowlege that doesn't exist.

 

AWyers

0 Kudos
Message 3 of 6
(3,587 Views)

Maybe it would help if I word it better like this... When the TDMS file is created, there is a channel with name TIME, and I need to read that channel.

0 Kudos
Message 4 of 6
(3,586 Views)

Hi AWyers,

 

You can use the TDMS Open then TDMS Read VI and give it inputs "(Your Group Name)" for Group Name In and "Time" for Channel Name In. This will give you the data from the "Time" channel as a waveform data type. You can then use Get Waveform Components with Y selected to get the array of "Time" data.

  

DylanC

0 Kudos
Message 5 of 6
(3,581 Views)

DylanC,

 

Your solution works as needed. Thank You.

 

I think I found a better solution though. Apparently if you convert a signal from the Express VI "Read from Measurement File" into a waveform the time data required is included, then you can convert to a string with a for loop and insert it as a row header into a table. The result gives me what I need. I attached a screenshot if someone is interested.

 

AWyers

0 Kudos
Message 6 of 6
(3,577 Views)