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.

mxCreateCellMatrix (C and Fortran)

2-D cell array

C Syntax

#include "matrix.h"
mxArray *mxCreateCellMatrix(mwSize m, mwSize n);

Fortran Syntax

#include "fintrf.h"
mwPointer mxCreateCellMatrix(m, n)
mwSize m, n



Number of rows


Number of columns


Pointer to the created mxArray, if successful. If unsuccessful in a standalone (non-MEX file) application, returns NULL in C (0 in Fortran). If unsuccessful in a MEX file, the MEX file terminates and returns control to the MATLAB® prompt. The function is unsuccessful when there is not enough free heap space to create the mxArray.


Use mxCreateCellMatrix to create an m-by-n two-dimensional cell mxArray. The created cell mxArray is unpopulated; mxCreateCellMatrix initializes each cell to NULL in C (0 in Fortran). To put data into cells, call mxSetCell.

mxCreateCellMatrix is identical to mxCreateCellArray except that mxCreateCellMatrix can create two-dimensional mxArrays only, but mxCreateCellArray can create mxArrays having any number of dimensions greater than 1.


See the following examples in matlabroot/extern/examples/mx.

Introduced before R2006a

Was this topic helpful?