DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Use "chnfind" to find two datapoints in a dataset that average below a certain value

I am using chnfind to find the first data point that is below a certain value, however there is some noise in the data, and so I need to be able to take two consecutive datapoints, average them, and repeat until the average is below 99. Attached is what the data looks like, and bleow is the current script I am using. I am new to vbs, but not coding.

 

Function startTime(syncGrp,syncChan)
     Dim indxStart, aSymbol(1), aValues(1)
     aSymbol(1) = "A"
     Set aValues(1) = Data.GetChannel("[" & syncGrp & "]/[" & syncChan & "]")
     indxStart = chnfind("A" & " > " & 100 ,,aSymbol, aValues)
     startTime = indxStart * Data.Root.ChannelGroups(syncGrp).Channels(syncChan).Properties("wf_increment").Value
end Function

0 Kudos
Message 1 of 2
(2,608 Views)

From this description, it sounds like you're trying to perform a moving average of the data.  Have you tried any of the smoothing functions in DIAdem to accomplish this?

 

Here is a KB that talks about using DIAdem Analysis to calculate a moving average.  Is this useful?

How Can I Calculate a Moving Average in DIAdem?

 

Highest Regards,

Paul
0 Kudos
Message 2 of 2
(2,545 Views)