DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a variable within ChnEventDetectionWindow

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! 

0 Kudos
Message 1 of 3
(2,158 Views)

Yes, it is possible to use ChnEvent... function in a loop like you did.

 

Greetings

Walter

0 Kudos
Message 2 of 3
(2,125 Views)

Hi Claudia,

 

Please see my thoughts on your question at this duplicate post:

 

https://forums.ni.com/t5/DIAdem/Creating-an-EventSearch-with-variable-as-condition-Within-a-For/m-p/...

 

Brad Turpin

Principal Technical Support Engineer

National Instruments

0 Kudos
Message 3 of 3
(2,090 Views)