duration

Time during which condition is valid

Description

example

duration(C) returns the number of seconds after the conditional expression, C, becomes true. The duration operator is reset if the conditional expression becomes false. If the duration operator is used within a state, it is reset when the state that contains it is entered. If the duration operator is used on a transition, it is reset when the source state for that transition is entered.

Examples

expand all

Transition out of the state when the variable x has been greater than or equal to 0 for longer than 0.1 seconds.

[duration(x>=0) > 0.1]

Tips

Introduced in R2017a