How Can I Merge Data from TDMS Files in LabVIEW?

Updated Jul 3, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I want to combine data from several TDMS files into a single file. Can this be done in LabVIEW?
  • I wish to save a combined, merged TDMS file. How can I do this in LabVIEW?

Solution

The data from TDMS files can be merged into a single file by extracting the file contents and using the TDMS Write function to write the data to a new file.

The LabVIEW code below involves opening two separate TDMS files and sending the channel names and data to a TDMS Write function. The data from each file is stored under a separate group name in the new TDMS file.
 

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram. 

Additional Information

The snippet code (shown above) uses the TDMS List Contents function to acquire the group and channel names within each file, as an array. The first row is then deleted from the array so that only the channel names remain.

This channel array is then fed into the TDMS Read function. This function collects the data from the existing TDMS file, so that it is ready to be accessed in LabVIEW.

The data collected from each file is then written into a new TDMS file. In this specific code, the data is stored under it's own group name in the new TDMS file. 

The file is then closed and the new, merged file can be viewed.

Attachments