Using the C++ Math Library    

Data Types

There are six fundamental data types (classes) in MATLAB, each one a multidimensional array. The six classes are double, char, sparse, int8, cell, and struct. The two-dimensional versions of these arrays are called matrices, hence the name MATLAB. The double precision matrix (double) and the character array (char) are the data types that are used most frequently. The other data types are for specialized situations like large-scale programming.

In MATLAB, every piece of data is an array. For example, a number like 17, which you might think is an integer, is stored by MATLAB as 1-by-1 array containing a double-precision floating-point number.

Every MATLAB array has some basic attributes: the size and shape of the array (i.e., the number of rows, columns, and pages for multidimensional arrays) and the array of double-precision floating-point numbers, which contains the data in the matrix. The data in an array can be either real or complex numbers. If an array stores complex numbers, it acquires a fourth attribute, a second double-precision array of floating-point numbers, the same size as the first. This second array stores the complex part of the matrix data. If an array has zero rows or columns it is a null, or empty, matrix.

Almost every operation or function call in MATLAB creates a new array. There are too many ways to create an array to list them all here. See Chapter 3, Working with MATLAB Arrays for a systematic discussion of this topic.

MATLAB also supports string arrays. Each character is 16 bits long; the array prints as strings of characters. To create a string array, surround the string with single quotes, for example, 'This is a string array'.


 MATLAB Basics Operators