06-22-2020 07:48 AM
Hello,
I am trying to simplify my script writing by creating a loop over a command that needs to iterate over several ranges.
Here is the code:
dim x,y
x = 0.5
y = 1
For x = 0.5 to 0.975
For y = 1 to 20
ChnEventList1 = ChnEventDetectionWindow("", "J_avg", x, x+0.5, 0, 0)
ChnEventList2 = ChnEventDetectionWindow("", "J_rate", -1000, 1000, 0, 0)
ChnEventResultList = ChnEventOperationAND(ChnEventList1, ChnEventList2)
'
ChnEventList1 = ChnEventResultList
Call ChnEventCreateFilteredTrueChn("[13]/[EventStatus_J" & y & "]", ChnEventList1, "J_rate", 0)
Next
Next
Is it possible to use a variable within a command? I bolded the spot of the code that does not work.
Thank you!
06-23-2020 06:54 AM
Yes, it is possible to use ChnEvent... function in a loop like you did.
Greetings
Walter
07-02-2020 04:10 PM
Hi Claudia,
Please see my thoughts on your question at this duplicate post:
Brad Turpin
Principal Technical Support Engineer
National Instruments