boolean - Convert numeric value to Boolean value - MATLAB (original) (raw)
Main Content
Convert numeric value to Boolean value
Syntax
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 logical1
(true
).
Note
The operator boolean
is supported in Stateflow® charts. In MATLAB®, use logical.
Examples
Cast the expression x+3
as a Boolean value and assign the value to the data y
.
Input Arguments
Numeric expression, specified as a scalar, vector, matrix, or multidimensional array.
Example: boolean(x+3)
Version History
Introduced before R2006a