isnumeric - Determine whether input is numeric array - MATLAB (original) (raw)
Main Content
Determine whether input is numeric array
Syntax
Description
`TF` = isnumeric([A](#mw%5F2cc97167-e92f-48a3-a3b8-7f0c036ec07c))
returns logical 1
(true
) if A
is an array of numeric data type. Otherwise, it returns logical 0
(false
).
Numeric types in MATLAB® include: int8
, int16
,int32
, int64
, uint8
,uint16
, uint32
, uint64
,single
, and double
. For more information, see Integer Classes andFloating-Point Numbers.
Examples
Determine Whether Number Is Numeric Type
Determine if a real number is a numeric type.
MATLAB® stores numeric data as a double-precision format by default, which is a numeric type.
Now create a signed 16-bit integer type using int16
. Check if it is a numeric type.
TF = isnumeric(int16(-256))
Determine Whether Infinity and NaN Are Numeric Type
Determine if an array containing infinity or not-a-number values is a numeric type.
Create several calculations that return Inf
and assign the results to an array. Check if the array is a numeric type.
MATLAB represents infinity by the special value Inf
as a double
type.
Create several calculations that return NaN
and assign the results to an array. Check if the array is a numeric type.
MATLAB represents not-a-number by the special value NaN
, as a double
type.
Determine Whether Arrays Are Numeric Type
Determine if an array containing floating-point numbers is a numeric type.
A = [-3.5e2 2.5; single(3) pi]
A = 2x2 single matrix
-350.0000 2.5000 3.0000 3.1416
Now create a cell array that contains the array A
and other numbers. Use class to identify the type of the cell array. Check if it is a numeric type.
B=2×2 cell array {2x2 single} {[-4]} {[ 2]} {[ 1]}
The cell array is not a numeric type since it is a cell type.
Input Arguments
A
— Input array
scalar | vector | matrix | multidimensional array
Input array, specified as a scalar, vector, matrix, or multidimensional array. MATLAB has the following numeric types.
Integer Type | Description |
---|---|
single | single-precision floating-point |
double | double-precision floating-point |
int8 | 8-bit signed integer |
int16 | 16-bit signed integer |
int64 | 64-bit signed integer |
int32 | 32-bit signed integer |
uint8 | 8-bit unsigned integer |
uint16 | 16-bit unsigned integer |
uint32 | 32-bit unsigned integer |
uint64 | 64-bit unsigned integer |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The isnumeric
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).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before R2006a