Time during which condition is valid
returns the length of time that has elapsed since the conditional expression
true and the associated state
became active. Specify time in seconds (
msec), or microseconds (
duration( is an alternative way to
The temporal logic operator
duration is not supported in
standalone charts in MATLAB®.
Guard Transition with Temporal Condition
Transition out of the state when the variable
x has been greater than or equal to 0 for longer than 0.1
[duration(x>=0) > 0.1]
Determine Elapsed Time
Store the number of milliseconds since the variable
x became greater than 5 and the state became
en,du: y = duration(x>5,msec);
You can use quotation marks to enclose the keywords
'usec'. For example,
duration('sec')is equivalent to
The Stateflow® chart resets the value of the
durationoperator if the conditional expression
falseor if the associated state becomes inactive.
durationoperator does not support conditions that depend on local or output structures. For more information, see Access Bus Signals Through Stateflow Structures.