Contents Previous Next Subchapters

Conversion To Logical
Syntax logical(value)
See Also int , char , coercion

Returns the element-by-element conversion of value to a logical value.

The logical function returns true, for each nonzero element of value and false for each zero element of value (these are printed as "T" and "F" respectively). If you enter
     logical([0, .3, 1])
O-Matrix will respond
     [ F , T , T ]
If value is complex, both the real and imaginary parts must be zero for logical to return false. Entering
     logical([0r0, 1i0, 0r0 + 1i0])
     [ F , T , T ]