asserts.inRange
Check that every value is inside an inclusive range.
📝Syntax
asserts.inRange(value, minValue, maxValue)
[res, msg] = asserts.inRange(value, minValue, maxValue)
📥Input Arguments
Parameter Description
value Real numeric or logical scalar or array.
minValue Inclusive lower bound. Scalar expansion is supported.
maxValue Inclusive upper bound. Scalar expansion is supported.
📤Output Arguments
Parameter Description
res true if the assertion passes, false otherwise.
msg assertion failure message, empty on success.
📄Description

The assertion passes when minValue <= value <= maxValue for every compared element.

Bounds can be scalars or arrays with dimensions compatible with value.

💡Examples
Inclusive range
asserts.inRange([1 2], 0, 3);
Capture an out-of-range value
[res, msg] = asserts.inRange([1 4], 0, 3);
🔗See Also
asserts.greaterOrEqualasserts.lessOrEqual
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub