logical

Converts a numeric value to logical type.

Syntax

  • Y = logical(X)

Input argument

  • X - a numeric value.

Output argument

  • Y - a logical value.

Description

logical converts a numeric value to logical type.

Nonzero value converted to true and zeros values converted to false.

Complex numbers returns an error.

Example

A = eye(2, 2)
B = logical(A)
islogical(B)

See also

islogical.

History

Author

Allan CORNET

Last updated