Numeric classes in MATLAB® include signed and unsigned integers, and single-precision and double-precision floating-point numbers. By default, MATLAB stores all numeric values as double-precision floating point. (You cannot change the default type and precision.) You can choose to store any number, or array of numbers, as integers or as single-precision. Integer and single precision arrays offer more memory-efficient storage than double precision.
All numeric types support basic array operations, such as indexing, reshaping, and mathematical operations.
Functions
Create Numeric Variables
double |
Double-precision arrays |
single |
Single-precision arrays |
int8 |
8-bit signed integer arrays |
int16 |
16-bit signed integer arrays |
int32 |
32-bit signed integer arrays |
int64 |
64-bit signed integer arrays |
uint8 |
8-bit unsigned integer arrays |
uint16 |
16-bit unsigned integer arrays |
uint32 |
32-bit unsigned integer arrays |
uint64 |
64-bit unsigned integer arrays |
Convert Between Numeric Types
cast |
Convert variable to different data type |
typecast |
Convert data type without changing underlying data |
Query Type and Value
isinteger |
Determine whether input is integer array |
isfloat |
Determine if input is floating-point array |
isnumeric |
Determine whether input is numeric array |
isreal |
Determine whether array is real |
isfinite |
Determine which array elements are finite |
isinf |
Determine which array elements are infinite |
isnan |
Determine which array elements are NaN |
Numeric Value Limits
eps |
Floating-point relative accuracy |
flintmax |
Largest consecutive integer in floating-point format |
Inf |
Create array of all Inf values |
intmax |
Largest value of specific integer type |
intmin |
Smallest value of specified integer type |
NaN |
Create array of all NaN values |
realmax |
Largest positive floating-point number |
realmin |
Smallest normalized floating-point number |