10-13-2016 09:32 AM
Hi,
I have a time stamp which is not real time, but next number. I know the interval (like 1 or 10 seconds) of measurements. So, I'm converting this to normal time. In this case I need to multiply this channel by specific interval. This is easy, because you can multiply channel by a constant like below:
Call ChnCalculate("Ch(""[2]/Seconds1"")= Ch(""[1]/#"") * 1") Call ChnCalculate("Ch(""[2]/Minutes1"")= Ch(""[2]/Seconds1"") / 60") Call ChnCalculate("Ch(""[2]/Hours1"")= Ch(""[2]/Minutes1"") / 60")
But how to do this using variable? Let's say we have variable s_interval and we want to put this variable instead of multiply it by constant .
Ch(""[1]/#"") * 1")
Do you know how to do this?
Best regards,
Piotr
Solved! Go to Solution.
10-14-2016 12:37 AM
Hi Piotr,
You can define it like this:
dim dFactor Call ChnCalculate("Ch(""[2]/Noise_1"")= Ch(""[2]/Noise_1"") / " & dFactor)
But I would prefer a DIAdem function for this calculation because it is faster using a well defined function than the calculator.
dim dFactor, dOffset dFactor = 10 dOffset = 0 Call ChnLinScale("[1]/Time", "[1]/Time", dFactor, dOffset)
or if you use the channel object:
dim oChn, dFactor, dOffset set oChn = Data.GetChannel("[1]/Time") dFactor = 10 dOffset = 0 Call ChnLinScale(oChn, , oChn, dFactor, dOffset)
Greetings
Walter
10-14-2016 02:30 AM
Thank you Walter! It works perfectly 😉
Best regards,
Piotr