Time during which condition is valid
duration(
returns the length of time that has elapsed since the conditional expression
C
,time_unit
)C
became true
and the associated state
became active. Specify time in seconds (sec
), milliseconds
(msec
), or microseconds (usec
).
duration(
is an alternative way to
execute C
)duration(C,sec)
.
Note
The temporal logic operator duration
is not supported in
standalone charts in MATLAB®.
You can use quotation marks to enclose the keywords 'sec'
,
'msec'
, and 'usec'
. For example,
duration('sec')
is equivalent to
duration(sec)
.
The Stateflow® chart resets the value of the duration
operator
if the conditional expression C
becomes
false
or if the associated state becomes inactive.
The duration
operator does not support conditions that
depend on local or output structures. For more information, see Access Bus Signals Through Stateflow Structures.