islogical - Determine if input is logical array - MATLAB (original) (raw)

Main Content

Determine if input is logical array

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

Extended Capabilities

expand all

The islogical function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced before R2006a