This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Numeric Types

Integer and floating-point data

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 subscripting, reshaping, and mathematical operations.


double Convert to double precision
single Convert to single precision
int8 Convert to 8-bit signed integer
int16 Convert to 16-bit signed integer
int32 Convert to 32-bit signed integer
int64 Convert to 64-bit signed integer
uint8 Convert to 8-bit unsigned integer
uint16 Convert to 16-bit unsigned integer
uint32 Convert to 32-bit unsigned integer
uint64 Convert to 64-bit unsigned integer
cast Cast variable to different data type
typecast Convert data types without changing underlying data
isinteger Determine if input is integer array
isfloat Determine if input is floating-point array
isnumeric Determine if input is numeric array
isreal Determine whether array is real
isfinite Array elements that are finite
isinf Array elements that are infinite
isnan Array elements that are NaN
eps Floating-point relative accuracy
flintmax Largest consecutive integer in floating-point format
Inf Infinity
intmax Largest value of specified integer type
intmin Smallest value of specified integer type
NaN Not-a-Number
realmax Largest positive floating-point number
realmin Smallest positive normalized floating-point number



MATLAB supports 1-, 2-, 4-, and 8-byte storage for integer data. If you use the smallest integer type that accommodates your data, you can save memory and program execution time.

Floating-Point Numbers

MATLAB represents floating-point numbers in either double-precision or single-precision format. The default is double precision.

Complex Numbers

Create complex numbers. Complex numbers consist of a real part and an imaginary part.

Infinity and NaN

MATLAB represents infinity by the special value inf, and values that are neither real nor complex by the special value NaN, which stands for "Not a Number".

Identifying Numeric Classes

You can check the data type of a variable using any of these commands.

Display Format for Numeric Values

The format function controls the display of numeric values. Changing the format does not change the values, only their display.

Combining Unlike Integer Types

If you combine different integer types in a matrix (e.g., signed with unsigned, or 8-bit integers with 16-bit integers), all elements of the resulting matrix are given the data type of the leftmost element.

Combining Integer and Noninteger Data

If you combine integers with double, single, or logical classes, all elements of the resulting matrix are given the data type of the leftmost integer.

Empty Matrices

If you construct a matrix using empty matrix elements, the empty matrices are ignored in the resulting matrix.

Concatenation Examples

These examples show how to concatenate different data types.

Was this topic helpful?