LOGICAL Convert to Logical

Section: Type Cast Functions

Usage

Converts the argument to a logical array. The syntax for its use is
   y = logical(x)

where x is an n-dimensional numerical array. Any nonzero element maps to a logical 1.

Example

Here we convert an integer array to logical:
--> logical([1,2,3,0,0,0,5,2,2])
ans = 
  <logical>  - size: [1 9]
 
Columns 1 to 9
 1  1  1  0  0  0  1  1  1  

The sampe example with double precision values:

--> logical([pi,pi,0,e,0,-1])
ans = 
  <logical>  - size: [1 6]
 
Columns 1 to 6
 1  1  0  1  0  1