duration
Time during which condition is valid
Description
returns the length of time, in seconds, that time
= duration(condition
)condition
stays
true
and the associated state became active.
returns the length of time in the unit specified by
time
= duration(condition
,time_unit
)time_unit
.
Note
The temporal logic operator duration
is not supported in
standalone charts in MATLAB®.
Examples
Input Arguments
Tips
You can use quotation marks to enclose the keywords
'sec'
,'msec'
, and'usec'
. For example,duration(x > 0,'sec')
is equivalent toduration(x > 0,sec)
.The Stateflow® chart resets the value of the
duration
operator if the conditional expressionC
becomesfalse
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.
Version History
Introduced in R2017a