Searching on the NI Forums to find a way of aligning two datasets didn't give me what I required, so to detail the issue:
Other programs such as Bosch MDA and Uniplot have this feature built in where data alignment is done with a simple, easy drag and drop on the X-axis. I'm surprised that Diadem does not have this.
Solved! Go to Solution.
You can generate a time or numeric channel in DIAdem to use as your X axis. It is under ANALYSIS-> Channel Functions-> Generate numeric/time channel. You can post an example of your data if you want an example solution/script
Upon loading the files, applying an offset to the shorter time channel will enable you to plot and compare the two groups (each channel needs to be plotted against its own group time channel). Just run this:
Call Calculate("ch(""Dataset 2 EXAMPLE/Time"") = ch(""Dataset 2 EXAMPLE/Time"") + 2209")
In this case I arbitrarily assigned the offset to be +2209 on the shorter time channel so that both groups end at the same time. So you must know what offset to apply to each channel because you dont have absolute time.
Is that the sort of direction you were looking for?
Thank you for investigating this.
The method is similar to what I require but I wanted to apply it to all channels rather than just each individual channel. Is there a script for that?
The solution gskylr offered scales the Time channel values in the File2 group to match the Time channel values in the File1 group. That DOES effectively apply the X axis offset to all the channels in that File2 group.
I'm including a VBScript I wrote a while back to allow you to perform this type of X axis scaling interactively in VIEW with the crosshair cursor. I also created a quick DataPlugin which I used to load your *.txt file, which I'm including as well, in case that's helpful.
So, first load these 2 *.txt files into an empty Data Portal in DIAdem. Then Plot the "Engine Speed vs. Time" curves from the File1 group and the File2 group on the same VIEW graph. Then position the crosshair cursor to X = 470 and Y = 2450. The vertical line of the curve cursor defines where the attached VBScript starts looking (left to right). Where the horizontal line of the curve cursor first intersects a curve is the rising edge that will be forced to match between the File1 and File2 curves. Now run the attached script "Time Align Curves.VBS". You will see the green curve jump to the right to overlap similar features of both curves. This is done by forcing the first value of the green curve intersected (to the right of its vertical line) by the horizontal line of the crosshair cursor to have the same X value as the first value of the red curve intersected. It only truly matches all the features to the extend that there is just one constant X axis offset. The math is the same as in gskylr's VBScript.
DIAdem Product support Engineer
I forgot to mention, the first time you run the attached VBScript, it adds a new "Time Align Curves" icon on the right side of the top icon bar in the VIEW panel. You can click that icon to re-run the VBScript without having to leave the VIEW panel.
DIAdem Product Support Engineer
This worked really well; thank you for posting this and also for creating the toolbar icon too; that was really useful.