Main Content

boolean

Convert numeric value to Boolean value

Description

tf = boolean(X) converts the numeric expression X into a Boolean value. If the expression evaluates to zero, boolean returns logical 0 (false). Otherwise, boolean returns logical 1 (true).

example

Note

The operator boolean is supported only in Stateflow® charts. In MATLAB®, use logical.

Examples

expand all

Cast the expression x+3 as a Boolean value and assign the value to the data y.

y = boolean(x+3);

Stateflow chart that uses the boolean operator.

Input Arguments

expand all

Numeric expression, specified as a scalar, vector, matrix, or multidimensional array.

Example: boolean(x+3)

Version History

Introduced before R2006a