DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Function to calculate the maximum duration of an event ?

Hello all,

I am not a expert in Diadem.

And I am searching to use a function to calculate the max duration of an event among many (for exemple, the max duration a signal sticks to 1) or to plot a curve of this duration.

 

Could you help me?

Thanks

Regards

0 Kudos
Message 1 of 2
(994 Views)

Hello Fred,

you can use the ChannelEvent functions of DIAdem for this.

Here is some script code that does such a calculation when the channels are named "Time" and "Data":

 

'-------------------------------------------------------------------------------
'-- VBS script file
'-- Comment:
'-------------------------------------------------------------------------------
dim myChnEventList, DurationChn, i

myChnEventList = ChnEventDetectionWindow("Time", "Data", 0.5, 2) ' Find the events
set DurationChn = data.Root.ActiveChannelGroup.Channels.Add("Durations",DataTypeChnFloat64) ' Create new Channel for all durations
for i = 1 to ChnEventCount(myChnEventList)
DurationChn(i) = ChnEventDuration(myChnEventList,i) ' Write duration values
next
msgbox "Maimum duration: " & Data.Root.ChannelGroups(1).Channels("Durations").Maximum ' Display the maximum duration

 

I hope this helps you,
DIAdemo

 

0 Kudos
Message 2 of 2
(961 Views)