DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

how to conjoin tdms files

Solved!
Go to solution

Can anybody help please..

My compact rio is recording over a number of weeks and to avoid data loss (power outage etc), the tdms logged files are split into 10mB chunks. The trouble starts when i try to join the files back up. The only way i can find is to drag all the files into the diadem navigator window, then use the view data table block operations copy data function for each file section - making a note of the new row total as the original file increases in length. This is a very boring and repetitive task.

Does somebody have a script function to perform this task by batch ?

Regards

Adek

0 Kudos
Message 1 of 15
(10,644 Views)
Maybe you can consider to write a VI, to read all the TDMS files out and write all the data to a new TDMS file.
0 Kudos
Message 2 of 15
(10,643 Views)

You can simply append one file to another using regular LabVIEW File I/O functions. The result will be a valid TDMS file. You need to do the same to the tdms_index files, or you can simply delete the index files. LabVIEW, DIAdem and other NI apps will automatically re-generate the index files when opening the tdms file.

 

If you conjoin large numbers (hundreds or more) files, you might want to defragment the resulting file for better reading performance.

 

Herbert

Message Edited by Herbert Engels on 01-07-2010 06:17 AM
Message 3 of 15
(10,627 Views)

Hey Adek,

 

The LabVIEW option is certainly there as Herbert described it and is particularly nice if you have only one type of concatenation that you always want to perform.  If on the other hand you want to pick which segmented files to concatenate together differently each time, then I'd recommend using the attached DIAdem VBScript application.  Just unzip all the files to the same directory and run the "Importing Data From Multiple DataPlugin Files.VBS" script in DIAdem-SCRIPT.

 

Ask if you have further questions,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 15
(10,588 Views)

Hi Brad, Herbert, Yongqing,

Thanks for the replies.

I've previously ran the importing data from multiple DataPlugin script from the Diadem examples menu, but this only seems to work with CSV file extensions, can you tell me how to adapt the script to work with TDMS file types ?

Regards

AdeK

0 Kudos
Message 5 of 15
(10,567 Views)

Hi adek,

 

Sure, I should have mentioned that.  You need to edit 2 lines, the line that defines which DataPlugin to use and the line that defines what the file dialog extension filter will be.  Please change the original lines 17 and 18:

 

FileExt = "*.CSV"

DataPlugin = "CSV"

To the following new lines 17 and 18:

 

FileExt = "*.TDMS"

DataPlugin = "TDMS"

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

 

 

0 Kudos
Message 6 of 15
(10,552 Views)

Hi Brad,

Thanks for the reply- I see that the modification was quite simple !.

The solution has saved me lots of time and relief from a repetitive task !

Thanks again

AdeK

0 Kudos
Message 7 of 15
(10,547 Views)

importing Data from Multiple DataPlugin Files.VBS

I have been using the script for concatenating TDMS files with great success, but now have a new set of files to concatenate which has two separate channel groups (analogue and temperature) with different time stamps (analogue at 2khz, temperature at 10hz) which results in different channel lengths, the problem is that the script looks for xoverlap = true and concatenates the two channel groups together combining the two x channels and the following analogue and temperature data (even though the analogue and temperature channels have different names. I can edit each file before concatentation to delete the second channel group, but each data log has been split into upto ten separate files and I have quite a few logs !

If the sub routine concatenate groups.vbs script can be modified to allow for to separate channel groups with individual time channels before concatenation over the separate files, this would by most helpful !

adek

0 Kudos
Message 8 of 15
(9,876 Views)
Solution
Accepted by adek

The most efficient way of doing this is actually through the command shell:

 

 

copy /b "C:\temp\merge tdms\test 0.tdms" + "C:\temp\merge tdms\test 1.tdms" + "C:\temp\merge tdms\test 2.tdms" /b "C:\temp\trash\blah.tdms"

 

 

It is safe to concatenate the TDMS_INDEX files, as long as you concatenate them in the same order. It is just as safe (and more convenient) to delete them. DIAdem will re-generate them.

 

If you intend to use wild cards in order to e.g. merge all files from a folder, you might need to find a way of making sure they get concatenated in chronological order. Windows won't do that by default.

 

Herbert

Message 9 of 15
(9,873 Views)

Thanks Herbert, this is a very simple solution !

0 Kudos
Message 10 of 15
(9,858 Views)