From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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

Modify Channels or Properties of a TDMS File in 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 demonstrates how to programmatically edit groups and channels on an existing TDMS file within LabVIEW.

See KB 4TE9SRQ2: Can I Delete Channels or Properties from a TDMS File with LabVIEW?

 

Description

The project contains two VIs (and example data files). The main VI creates a new TDMS file with three groups, each with its own channel and data. The subVI is then called to convert the TDMS file to a TDM file in order to remove the specificied group. Finally, the main VI opens a TDMS File Viewer to observe the TDMS changes.

 

Requirements

  • LabVIEW 2012 (or compatible).

 

Steps to Implement or Execute Code

  1. Open the appropriate version of the TDMS Example project.
  2. Open Create Modify TDMS.vi (main VI).
  3. Open the Block Diagram and note that three groups are created for a specified TDMS file each with their own channel and data associated with it. One of these channels is then removed from the file.
  4. Return to the Front Panel and select the file path for the TDMS and TDM files (NOTE: The VI is currently set to overwrite a pre-existing file if one chosen).
  5. Run the Create Modify TDMS.vi.
  6. During execution, a separate TDMS File Viewer will open.
  7. Expand the TDMS file in the left pane of the viewer to observe that there are only two groups present.
  8. Highlight one of the file sections in the left pane and view the values in the Values (table) tab in the right pane.
  9. Select "Quit" on the TDMS Viewer when done (this will also stop the VI).

 

Additional Information or References

TDMS Example FP.png

 

TDMS Example BD.png

 

TDMS Viewer.png

 

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

David C

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