Main Content


Time during which condition is valid in Requirements Table block

Since R2022a



time = duration(condition) returns the length of time, in seconds, that condition stays true. Use this operator in the Requirements Table block.


expand all

Set a equal to 1 when the time that the input data u is greater than or equal to 0 exceeds the value of y. Otherwise, the block sets a equal to 0.

Requirements table using the duration operator in a precondition.

Input Arguments

expand all

Logical condition, specified as true or false. You can specify the value of condition by using an expression that evaluates to true or false. The operator evaluates condition at each time step.

condition does not support expressions that depend on local or output data.

Example: duration(u)

Example: duration(u>=0)

Data Types: logical

Units of time that duration returns, specified in seconds (sec), milliseconds (msec), or microseconds (usec).

Data Types: enumerated

Output Arguments

expand all

Length of time, in seconds, that condition stays true, returned as a scalar double.


  • The Requirements Table block resets the output of the duration operator if condition becomes false or if the block becomes inactive.

Version History

Introduced in R2022a