09-20-2023 04:29 AM
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
09-22-2023 08:40 AM
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