06-03-2022 07:23 AM
I want to calculate the absolute value of an channel and save the result in another channel.
But this code as described in the documentation does not work:
dd.Calculate("Ch(""Group3/Result"")= Abs(Ch(""Group1/Input""))")
But the same code works as .VBS Script:
Call Calculate("Ch(""Group3/Result"")= Abs(Ch(""Group1/Input""))")
How can I achieve the same behaviour in Python?
Thanks for your help!
Solved! Go to Solution.
06-07-2022 03:15 AM
Hi blume,
The problem is the double quotation marks
This here will work:
dd.ChnCalculate('Ch("Group1/Result")= Abs(Ch("Group1/Input"))')
Greetings
Walter
06-07-2022 04:00 AM
Thank you very much!
06-21-2022 02:28 AM
Is it possible to do this calculation in a for loop?
For example:
for j in range(2, 5): dd.ChnCalculate('Ch("Group1/Result")= Abs(Ch("[1]/[j]"))')
Greetings
blume
06-21-2022 04:03 AM
You can try this:
for j in range(1, 5): dd.ChnCalculate('Ch("Group1/Result' + dd.str(j) + '")= Abs(Ch("[1]/[' + dd.str(j) + ']"))')
Greetings
Walter