islogical

Determine if input is logical array

Syntax

tf = islogical(A)

Description

tf = islogical(A) returns true if A is a logical array and false otherwise. islogical also returns true if A is an instance of a class that is derived from the logical class.

Examples

These examples show the values islogical returns when passed specific types:

% Relational operators return logical values
islogical(5<7)
ans =
     1

% true and false return logical values
islogical(true) & islogical(false)
ans =
     1

% Constants are double-precision by default
islogical(1)
ans =
     0

% logical creates logical values
islogical(logical(1))
ans =
     1

See Also

| |

Was this topic helpful?