08-29-2011 04:22 PM
Hi everyone,
Does anyone know how I can reverse the values of a waveform channel in Diadem? ( practically perform the Reverse 1D Array function of Labview).
Cheers
Solved! Go to Solution.
08-30-2011 09:47 AM
Hi Saloutios,
So let's say your starting waveform channel has waveform properties that define the X axis to run from 0 to 0.999 with a step with of 0.001, for a total of 1000 values. Are you asking how to redefine the waveform properties so that the X axis instead starts at 0.999 and descends down to 0 with a step width of -0.001? If that's what you want, just redefine the waveform properties like this:
Set Channel = Data.Root.ChannelGroups(1).Channels(3) StartValue = Channel.Properties("wf_start_offset").Value Increment = Channel.Properties("wf_increment").Value Length = Channel.Properties("length").Value EndValue = StartValue + (Length-1)*Increment Channel.Properties("wf_start_offset").Value = EndValue Channel.Properties("wf_increment").Value = -Increment
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-30-2011 02:15 PM - edited 08-30-2011 02:24 PM
Hi Brad,
Thanks for the reply. Yes, that's what I am trying to do. Just to make it clear, I dont want just the X axis to change order but also the Y values, eg. if my channel values are:
time X: [0, 0,001, 0,002, 0,003, ..., 0,999]
Y: [8, 5, 7, 2, ..., 9]
I would like the get a channel that looks like:
time X: [0,999, ..., 0,003, 0,002, 0,001, 0]
Y: [9, ... , 2, 7, 5, 8]
When I view my channel at the VIEW tab, the x-axis should start at 0,999 and descent as you move to the right to 0.
I tried to run your script but I ran into an error about an undefined variable ''Channel''. I am sorry but I do not know VBScripting so if you could incoporate a dialog box prompting which channels I would like to reverse, I would be grateful.
Cheers
08-30-2011 04:31 PM
Hi Saloutios,
Good news and bad news. You can invert the array order of the Y values by using the ChnInvert() command. You can also change the display of the X axis in REPORT to "Inverted" instead of linear and get the desired display on the X axis WITHOUT any waveform property changes or the ChnInvert() command. But you're stuck in VIEW. No matter how you order the X and Y values, VIEW will always plot increasing X values from left to right.
Why DO you want the higher X value on the left of the VIEW graph's X axis?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-30-2011 04:42 PM
Hi Brad,
Thanks for the quick reply. Sorry, my mistake, wanted to write REPORT, not VIEW tab. Is it easy for you to provide a final script that could undertake the task with a dialog box asking which channels to process? Unfortunately I cannot perform changes at the script you provided.
Cheers
08-30-2011 10:55 PM
Hi Saloutios,
Well then you're all set. You don't need to change the channel values or the waveform properties. Just leave everything the way it is except change the X axis scaling type from "Linear" to "Inverted" in the Curve and Axis Definition, then save that setting change to the *.TDR file.
No programming required,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-31-2011 01:56 PM
Thanks a lot Brad!