Example Code

TDMS Combine and Rerrange

Code and Documents

Attachment

Overview

This is demo code showing how to easily combine multiple TDMS files into one, or how to append a TDMS file to an existing one, using a binary copy method which is faster than reading and parsing the TDMS file.  Also included in this is a demo on how to rearrange channels in a group in a TDMS file using this combine feature.

 

Description

TDMS files have a feature that is somewhat similar to a text or CSV file.  If one file is appended to another the data is also appended and the newly created TDMS file will be valid.  Another feature of TDMS is that the order of a channel in a file is defined by the first write that takes place on the file.  This means that if you want to rearrange the order of channels in a TDMS file, all that is needed is to create a file with no data, but contains the order, and then append the TDMS file that has data to this header only TDMS.  This code demonstrates this.

 

Hardware and Software Requirements

LabVIEW 2015 or newer.

Various OpenG packages (VIPC included)

 

Steps to Implement or Execute Code

Unzip the attached zip, run the Demo Rearrange TDMS.vi.  Select a TDMS file, one is included in the zip.  Follow the instructions on the front panel of the VI which is to select a group, drag the channels around, then save the new TDMS file.

 

TDMS Demo.png

 

Also included in this zip is the Combine TDMS Files.vi which this demo uses.  Call this polymorphic VI with either two TDMS files, where one will be appended to the other, or provide an array of TDMS files, which will then create a new output file.

 

Additional Information or References

Original discussion can be found here

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

Contributors