Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
21 ratings:
 4.47 out of 5   

How Do I Include a Time Stamp in a File Using the Write To Measurement File VI?

Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

When I use the Write to Measurement File Express VI, I want the X value column to be the CPU time stamp. By default, the X value column has time values that start only when the execution starts. How can I change this?

This can be done in two ways. The first way is for writing to a .lvm file, and the second is for writing to a .tdms.

For a .lvm file:
  1. The DAQ Assistant is acquiring data continuously.
  2. Use the Get Date/Time in to acquire the time at which the data is acquired.
  3. Use the Format Date/Time to convert the time stamp data into a string that can be wired into the comment section of the Write to Measurement
  4. Concatenate the time string with a tab constant so that the data appears correctly in the text file.
  5. Wire the final time data into the Comment input of the Write to Measurement
Drag this code into LabVIEW 2009 or later to edit it instantly!

Now the CPU time will show up in the text file next to the data that you are writing in the while loop.  If you are acquiring more than 1 sample in the DAQ Assistant, only one value of time will show up for all the samples that you acquire. The resulting measurement file will have one time stamp at the beginning of each measurement set.  A screenshot is shown below.

Note: You would also need to select Empty Time Column in the configuration for the Write To Measurement, if you do not want the default time data to appear.

For a .tdms file:
  1. Acquire data in continuous mode using a DAQ Assistant.
        Note: This method will also work with DAQmx VIs that are acquiring waveform data.
  2. Wire the output of the DAQ Assistant to the Write to Measurement
  3. Configure the Write to Measurement to log time in One column only with One header only, as in the settings below:

Now the time stamp will be logged in a column to the left of the measurements under the heading Time, and the dt value will be logged under the heading Time*. A screenshot of the resulting .tdms file in Excel is shown below: 

Note: Unlike with a .lvm file, a .tdms file will record a timestamp for every data point.

Related Links:
KnowledgeBase 3PJC3B8: How do I Convert a Date/Time String into a Timestamp Constant in LabVIEW?
KnowledgeBase 4NREG75X: Why is my Time Stamp One Hour Off When I Read Time Data From a File?

Attachments: -

Report Date: 01/26/2007
Last Updated: 06/09/2017
Document ID: 45PB9S9U

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit