Section: Type Conversion Functions
y = logical(x)
where x
is an n
-dimensional numerical array. Any nonzero
element maps to a logical 1.
logical
:
--> logical([1,2,3,0,0,0,5,2,2]) ans = 1 1 1 0 0 0 1 1 1
The sampe example with double precision values:
--> logical([pi,pi,0,e,0,-1]) ans = 1 1 0 1 0 1