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

Programmatically merge all TDMS files contained in a folder using LabVIEW

Code and Documents

Attachment

Download All

Overview

This example VI demonstrates the method of iterating TDMS files, building a new "Merged" TDMS log file.

 

Description

This is an example VI that allows the user to define a folder containing multiple TDMS files, the VI subsequently iterates through each TDMS file in turn, building a new "Merged" TDMS log file.

It utilises the Producer/Consumer and State Machine architectures with Binary File I/O.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Open the project " Merge TDMS Files 2012 NIVerified. lvproj ".
  2. Open the VI " TDMS Folder To Merge.vi".
  3. Select a path.
  4. Run the VI.

 

Additional Information or References
VI Block Diagram of "TDMS Folder To Merge.vi"

Block Diagram.png

 

 

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

 

Jamie S.

Applications Engineer
National Instruments

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

Comments
davideboido
Member
Member
on

Please, could you provide this useful vi in a preceding LV version? At least 2010.

Many thanks

moxi
Member
Member
on

Thank you for such a great tool.

kabooom
Member
Member
on

Hi tanks for the tool.

But i have some remarks : there is a problem with the order of the file, when you build the array, you add the file at the begining, in my case the merged file was in the wrong order (first file added at the end).

It would be nice to check the date of the file and add the oldest first...

luisanro1
Member
Member
on

Thank you, the tool is very useful.

As kabooom says... how can we change the order of the merged file? (from oldest to newest)

Nicholas_Herrick
Member
Member
on

Works great! Nice job. Thank you.

flaviaf76
Member
Member
on

The tool is useful, but as and luisanro1 mentioned the order of the merged file is from oldest to newest.

To solve this problem, I add the "Reverse 1A Array" block connected to the output "Filenames" of the "List Folder" block and before the "For-loop" in the case "TDMS Check" in the "Consumer Loop" (see figure).

 

right_order_solved_.png