From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

integrating starting at t=0 when ch. contains pre-trig data

Looking for an efficient method for integrating a channel (starting at time = 0) when that channel contains pre-trigger data (starts at -.1 sec)
0 Kudos
Message 1 of 2
(3,363 Views)
Hi,

I hope this short VBScript is the functionality you are looking for:

Option Explicit
' decalration
Dim iLoop, iLoopMax, iChnNo

' save original channel
call formulacalc("ch('X_Chn_Cop') := ch('X_Chn')")
' find line with first value = 0
call formulacalc("L1 := find('X_Chn_Cop' >= 0)")

'loop to set NOVALUES which not will be calculated
for iLoop = 1 to iLoopMax
chdX(iLoop, iChnNo) = Null
next

' get channel no for CHDX
iChnNo = cno("X_Chn_Cop")
' set loop end
iLoopMax = L1 - 1

' integrate
Call CHNINTEGRATE("X_Chn_Cop","Input channel for Y Values","Y_integral_1")

Best regards

Walter
Message 2 of 2
(3,363 Views)