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 ?
Solved! Go to Solution.
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.
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,
DIAdem Product Support Engineer
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 ?
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"
DIAdem Product Support Engineer
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 !
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 !
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.