logical
Converts x to a logical type.
Syntax
logical(x)
Inputs
- x
- A numeric value.
Outputs
- R
- Either true (1) or false (0). The numeric value 0 goes to false, while every other numeric value goes to true.
Examples
logical(10)
ans = 1
logical(0)
ans = 0
logical(NaN)
Error: cannot convert NaN to logical