12-09-2014 10:18 AM
This question is in French and English.
Bonjour,
J'essaie de trouver un moyen de concaténer/fusionner plusieurs fichiers TDMS de mesures analogiques avec DIAdem 2012, afin de n'avoir plus qu'un seul fichier. J'en fournis 1 en pièce jointe.
Je suis débutant en DIAdem et ne connaîs pas le langage du code de script. En cherchant sur ce forum, j'ai trouvé le script "Importing Data From Multiple DataPlugin Files.VBS", et ai modifié les lignes 17 et 18 en remplaçant "csv" pas "tdms" (comme c'était indiqué sur un autre sujet sur le forum). Ce script fait aussi appel à "Concatenate Groups".
Le problème est que les fichiers TDMS contiennent plusieurs groupes (désignant des slots de chassis de mesures) contenant chacun plusieurs channels différents. Ce script concatène donc chaque groupe et le résultat n'a plus de sens. Le script à modifier est certainement "Concatene Groups", mais de quelle façon ?
Merci à vous,
Olivier
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I try to find a way to concatenate/merge several TDMS files of analog measurements with DIAdem 2012, in order to have in the end only one file. You can find 1 of these files with my mail.
I'm a beginner in DIAdem, and do not know the language of the script code.
By searching on this forum, I found the script "Importing Data From Multiple DataPlugin Files.VBS" and have modified the lines 17 and 18, replacing "csv" with "tdms" (as was shown in another subject on the forum). This script also uses "Concatenate Groups".
The problem is that the TDMS files contain several groups (designating measurements chassis slots) each containing several different channels. So this script concatenates each group and the result is meaningless. I think the script which must be changed is "Concatene Groups", but how ?
Thank you,
Olivier
Solved! Go to Solution.
12-10-2014 08:04 AM
Because TDMS is a streaming format the easiest way to concatenate tdms files is to use a dos box and a copy command.
copy /B *.tdms target.tdms
will concatenate all tdms files in a given folder into a single file.
Be aware that *.tdms is not a good ordered by. So if it does not work out by accident for you, you have to specify a order of files.
copy /b a.tdms + b.tdms + c.tdms target.tdms
. You can also embed this in a script by calling the copy command by calling
Dim oShell Set oShell = CreateObject("WScript.Shell") oShell.run "cmd /K copy /b a.tdms + b.tdms + c.tdms target.tdms" Set oShell = Nothing
There is also an example "Concatenate channels" that is part of DIAdem help. But it also needs adjustment to do your job.
12-11-2014 09:54 AM
Hi Oliver,
Try running the script you downloaded once for each group, and encodinng the group to load in the "ChannelSet" assignment in line 10 using the group index, like this:
ChannelSet = "[1]/*" or ChannelSet = "[2]/*"
I just discovered that this example breaks in DIAdem 2014 because the "DataFileHeaderAccess" command has been relegated and replaced by a new one. I'll need to update it soon.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
01-08-2015 02:11 AM
Hello everyone, unfortunately I am also facing the same problem. In my case I need to write a script which will concatenate several files to create a single one, but the script will automatically order the files as per the time. I have tried a lot but unable to figure out how to compare time in diadem script. For example say ;if time is 15:00 then do this. After converting the time channel to absolute value, I just cant understand , what to write inside the IF block, the absolute time, the numeric value or something else. Please help !!
01-08-2015 12:03 PM
Hi module,
You'll need to be more specific. What do you mean by, "if time is 15:00 then do this".
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-05-2015 04:01 AM
Hi Brad,
Thank you very much for replying. To be specific I have two problems.
1st one : I have channels with time and temperature and I need to calculate the mean temperature of a day, between time 09:00 am in the morning and 03:00 pm in the afternoon. I was thinking of running a loop which will start at when time is 09:00 am and stop at 03:00 pm. As the time channel contains days of a whole month, so loop should recognise the time as 09:00 am, irrespective of date. But I am unable to compare time. I tried with this code
"if (timeAbsolut(count)="09:00:00:0000") then "
but its of no use. Hope you can understand.
2nd one: I need to create a script which will accpt data files (I have data files in day format and month format) and merge them to make a single file. Each file has 2 groups (with separate time channel for each group) and each group has multiple channels. The code will merge the files taking care of the groups as well as the time. That is the merger should be as per the absolute time of each data file (i.e. 15th november then 16th november and so on to make november month file or january then february and so on to make a year file). If you want I can send you some data files and the code with which I am trying this right now. Thanks again for your help.
Regards
02-05-2015 11:34 AM
Hi module,
Please do post multiple files that you want concatenated according to time. I will be able to learn the answers to most of my questions by investigating the data files directly on my computer.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-21-2019 03:00 PM - edited 11-21-2019 03:00 PM
Hello Everyone ,
I am new to DIAdem and looking for script which merges tdms or mf4 files in DIAdem.
Thanks!
12-05-2019 05:16 PM
Hi Sovarian,
The simplest approach is to right-click on the selected files in the NAVIGATOR and choose the context menu "Append Data". You can do the same thing programmatically by including the following 3rd parameter each time you DataFileLoad() a data file:
Call DataFileLoad(DataFilePath, DataPluginName, "Append")
Brad Turpin
Senior Technical Support Engineer
National Instruments