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®.
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]
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
if the conditional expression
false or if the associated state becomes inactive.
duration operator does not support conditions that
depend on local or output structures. For more information, see Access Bus Signals Through Stateflow Structures.