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

Updated Jan 14, 2019

Reported In


  • LabVIEW
  • SignalExpress

Issue Details

  • I would like to include time in my data when logging to a file, how do I do this?
  • 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?
  • I am taking measurements from a counter input, which does not include timestamps, how can I add these?


In LabVIEW, this can be done in two ways depending on the file type that is saved to. The two main file types are .tdms and .lvm.

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 configured for acquiring waveform data.
  2. Wire the output of the DAQ Assistant to the Write to Measurement File VI
  3. Configure the Write to Measurement File VI 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.

For a .lvm File 

  1. The DAQ Assistant is set to acquire data continuously.
  2. Use the Get Date/Time in Seconds VI to acquire the time at which the data is acquired.
  3. Use the Format Date/Time String VI to convert the time stamp data into a string that can be wired into the comment section of the Write to Measurement File VI.
  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 File VI.
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 File VI, if you do not want the default time data to appear. 

Additional Information

Enabling the One Column per channel option under the X Value (Time) Columns will insert an additional column for each channel, increasing considerably the file size for each additional channel.

For Counter Inputs In LabVIEW & Signal Express

Most counters in C-series DAQ modules do not inherently timestamp their measured data. When using LabVIEW this can be solved with the "For a .lvm File" method above, but applied to any file type.
When using Signal Express, the timestamps must be calculated outside of the programme in a software such as excel using the following formula: 

Where t is the timestamp for given sample s, t0  is the starting time of the measurements, nt is the number of total samples and fs is the sampling rate (this is 1 KHz for most devices).


Not Helpful