MATLAB Application Program Interface Reference Help Desk

The MATLAB Array

Description

The MATLAB language works with only a single object type -- the MATLAB array. All MATLAB variables, including scalars, vectors, matrices, strings, cell arrays, and structures are stored as MATLAB arrays. The mxArray declaration corresponds to the internal data structure that MATLAB uses to represent arrays. The MATLAB array is the C language definition of a MATLAB variable. This mxArray structure contains, among other things:

Matrices, or m-by-n arrays, that are not sparse are called full. In the case of a full matrix, the mxArray structure contains parameters called pr and pi. pr contains the real part of the matrix data; pi contains the imaginary data, if there is any. Both pr and pi are one-dimensional arrays of double-precision numbers. The elements of the matrix are stored in these arrays columnwise. This is how Fortran stores matrices; MATLAB uses this convention because it was originally written in Fortran.

Sparse matrices have a different storage convention in MATLAB. The parameters pr and pi are still arrays of double-precision numbers, but there are now three new parameters, nzmax, ir, and jc:



[ Previous | Help Desk | Next ]