| MATLAB Application Program Interface | Search  Help Desk |
| mxCreateCellArray | Examples See Also |
Create an unpopulated N-dimensional cell mxArray
C Syntax
#include "matrix.h" mxArray *mxCreateCellArray(int ndim, const int *dims);
Arguments
ndimmxArray, set ndim to 3.
dims
mxArray in that dimension. For example, setting dims[0] to 5 and dims[1] to 7 establishes a 5-by-7 mxArray. In most cases, there should be ndim elements in the dims array.
Returns
A pointer to the created cellmxArray, if successful. If unsuccessful in a stand-alone (nonMEX-file) application, mxCreateCellArray returns NULL. If unsuccessful in a MEX-file, the MEX-file terminates and control returns to the MATLAB prompt. Causes of failure include:
ndim that is greater than the number of values in the dims array.
Description
UsemxCellArray to create a cell mxArray whose size is defined by ndim and dims. For example, to establish a three-dimensional cell mxArray having dimensions 4-by-8-by-7, set
ndim = 3; dims[0] = 4; dims[1] = 8; dims[2] = 7;The created cell
mxArray is unpopulated; that is, mxCreateCellArray initializes each cell to NULL. To put data into a cell, call mxSetCell.
Example
Seephonebook.c in the refbook subdirectory of the examples directory.
See Also
mxCreateCellMatrix, mxGetCell, mxSetCell, mxIsCell