MATLAB Function Reference |
Syntax
k = iscell(C) TF = isnan(A) k = iscellstr(S) k = isnumeric(A) k = ischar(S) k = isobject(A) k = isempty(A) TF = isprime(A) k = isequal(A,B,...) k = isreal(A) k = isfield(S,'field
') TF = isspace('str
') TF = isfinite(A) k = issparse(S) k = isglobal(NAME) k = isstruct(S) TF = isinf(A) k = isstudent TF = isletter('str
') k = isunix k = islogical(A)
Description
k = iscell(C)
returns logical true (1
) if C
is a cell array and logical false (0
) otherwise.
k = iscellstr(S)
returns logical true (1
) if S
is a cell array of strings and logical false (0
) otherwise. A cell array of strings is a cell array where every element is a character array.
k = ischar(S)
returns logical true (1
) if S
is a character array and logical false (0
) otherwise.
k = isempty(A)
returns logical true (1
) if A
is an empty array and logical false (0
) otherwise. An empty array has at least one dimension of size zero, for example, 0-by-0 or 0-by-5.
k = isequal(A,B,...)
returns logical true (1
) if the input arrays are the same type and size and hold the same contents, and logical false (0
) otherwise.
k = isfield(S,'
field
')
returns logical true (1
) if field
is the name of a field in the structure array S
.
TF = isfinite(A)
returns an array the same size as A
containing logical true (1
) where the elements of the array A
are finite and logical false (0
) where they are infinite or NaN
.
For any A
, exactly one of the three quantities isfinite(A)
, isinf(A)
, and isnan(A)
is equal to one.
k = isglobal(NAME)
returns logical true (1
) if NAME
has been declared to be a global variable, and logical false (0
) if it has not been so declared.
TF = isinf(A)
returns an array the same size as A
containing logical true (1
) where the elements of A
are +Inf
or -Inf
and logical false (0
) where they are not.
TF = isletter('
returns an array the same size as str
')
'
str
'
containing logical true (1
) where the elements of str
are letters of the alphabet and logical false (0
) where they are not.
k = islogical(A)
returns logical true (1
) if A
is a logical array and logical false (0
) otherwise.
TF = isnan(A)
returns an array the same size as A
containing logical true (1
) where the elements of A
are NaN
s and logical false (0
) where they are not.
k = isnumeric(A)
returns logical true (1
) if A is a numeric array and logical false (0
) otherwise. For example, sparse arrays, and double-precision arrays are numeric while strings, cell arrays, and structure arrays are not.
k = isobject(A)
returns logical true (1
) if A is an object and logical false (0
) otherwise.
TF = isprime(A)
returns an array the same size as A
containing logical true (1
) for the elements of A
which are prime, and logical false (0
) otherwise.
k = isreal(A)
returns logical true (1
) if all elements of A
are real numbers, and logical false (0
) if either A
is not a numeric array, or if any element of A
has a nonzero imaginary component. Since strings are a subclass of numeric arrays, isreal
always returns 1
for a string input.
Because MATLAB supports complex arithmetic, certain of its functions can introduce significant imaginary components during the course of calculations that appear to be limited to real numbers. Thus, you should use isreal
with discretion.
TF = isspace('
returns an array the same size as str
')
'
str
' containing logical true (1
) where the elements of str
are ASCII white spaces and logical false (0
) where they are not. White spaces in ASCII are space, newline, carriage return, tab, vertical tab, or formfeed characters.
k = issparse(S)
returns logical true (1
) if the storage class of S
is sparse and logical false (0
) otherwise.
k = isstruct(S)
returns logical true (1
) if S
is a structure and logical false (0
) otherwise.
k = isstudent
returns logical true (1
) for student editions of MATLAB and logical false (0
) for commercial editions.
k = isunix
returns logical true (1
) for UNIX versions of MATLAB and logical false (0
) otherwise.
Examples
s = 'A1,B2,C3'; isletter(s) ans = 1 0 0 1 0 0 1 0
B = rand(2,2,2); B(:,:,:) = []; isempty(B) ans = 1
A = B = C = 1 0 1 0 1 0 0 1 0 1 0 0
isequal(A,B,C)
returns 0
, and isequal(A,B)
returns 1
.
a = [-2 -1 0 1 2]
isfinite(1./a) = [1 1 0 1 1] isinf(1./a) = [0 0 1 0 0] isnan(1./a) = [0 0 0 0 0]
isfinite(0./a) = [1 1 0 1 1] isinf(0./a) = [0 0 0 0 0] isnan(0./a) = [0 0 1 0 0]
See Also
isappdata
, ishandle
, ishold
, isjava
, iskeyword
, ismember
, isstr
, isvalid
, isvarname
ipermute | isa |