Skip to Main Content Skip to Search
Product Documentation

isnumeric - Determine whether input is numeric array

Syntax

tf = isnumeric(A)

Description

tf = isnumeric(A) returns logical 1 (true) if A is a numeric array and logical 0 (false) otherwise. For example, sparse arrays and double-precision arrays are numeric, while strings, cell arrays, and structure arrays and logicals are not.

Examples

Given the following cell array,

C{1,1} = pi;                 % double
C{1,2} = 'John Doe';         % char array
C{1,3} = 2 + 4i;             % complex double
C{1,4} = ispc;               % logical
C{1,5} = magic(3)            % double array

C = 
   [3.1416] 'John Doe' [2.0000+ 4.0000i] [1][3x3 double]

isnumeric shows that all but C{1,2} and C{1,4} are numeric arrays.

for k = 1:5
x(k) = isnumeric(C{1,k});
end

x
x =
     1     0     1     0     1

See Also

is* | isa | isfinite | isinf | isnan | isprime | isreal | isstrprop

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS