From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Convert TDMS Waveform Data into Excel Readable LVM Text Files Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example VI will convert a TDMS file into text files that can be read in Excel (tab-delimited ASCII text).

 

Description

The converted TDMS files will have the extension .lvm. The data can be broken up into a set of files which will share a base name, but with an additional number at the end of the file name denoting their order. This example was created because the Write to Measurement File Express VI will reset the time data for each new file created from a large waveform with a real timestamp for t0.

 

The final text files will each contain an identical header of data. This header will have the channel group name, waveform time stamp, sample time interval and channel name for each column.

 

Requirements

Software:

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Run the VI.

2. Enter the path to the TDMS file you wish to convert in the Measurement File path control.

3. Enter the path for the save folder in the Save Folder path control. This is the folder in which the converted text files will be saved.

4. Enter the filename for the saved files in the Saved File Name string control. This is the name of the saved files which will be created by the VI.

5. When prompted with the file selection dialog, navigate to the TDMS file you wish to convert.

6. When the conversion is complete, the VI will terminate execution. Note that this VI will take several seconds to execute for large file sizes. (45 seconds for waveforms with 180000 samples.) The time is mostly spent generating the time data for the final spreadsheet.

 

Additional Information or Resources

 

2012.png

 

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Herbert Engels
NI Employee (retired)
on

If all you want to do is read TDMS files in Excel, you can also use the TDMS Excel Add-In. It doesn't split up your data into multiple files, though.

Herbert

Captain_Kirby
NI Employee (retired)
on

Your exactly right Herbert. By far, that's the best way to read TDMS files in Excel. Thank you for adding that link. The only real advantage to this example is the slicing into multiple files, and the fact that you don't have to have the TDMS Add-in for each computer you want to view the data on.

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!