Mathematics Previous page   Next Page

Introduction

MATLAB provides several data types that you can assign to numbers or numerical variables. By default, MATLAB assigns numbers the data type double, which means that they are double-precision floating-point numbers that are 64 bits in length. MATLAB performs operations on numbers of type double using double-precision arithmetic. For most numerical purposes, double is the recommended data type.

Besides double, MATLAB also provides several other data types that require less memory than double. These include

These data types are useful if you need to conserve memory, for example, if you are working with very large data sets such as image files. The following sections explain the issues you need to keep in mind when performing operations on nondouble data types:

Data Types in the MATLAB Programming documentation provides more information about these data types.

The following MATLAB functions return output of type single or an integer data type when you call them with the optional input argument datatype, which is a string containing one of data types listed above:

For example,

returns a 2-by-2 matrix of ones of type int8.

In addition, the following functions return output of type single when you call them with the input argument 'single':

See the reference pages for these functions for more information.


Previous page  Nondouble Data Types Integer Mathematics Next page

© 1994-2005 The MathWorks, Inc.