| MATLAB Application Program Interface Reference | Help Desk |
mxCreateCellMatrix
Create an unpopulated 2-dimensional cellmxArray
#include "matrix.h" mxArray *mxCreateCellArray(int m, int n);m n
The desired number of columns.
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. Insufficient free heap space is the only reason for mxCreateCellMatrix to be unsuccessful.
Use mxCreateCellMatrix to create an m-by-n two-dimensional cell mxArray. The created cell mxArray is empty; that is, mxCreateCellMatrix initializes each cell to NULL. 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.
Create an unpopulated 2-by-2 cell mxArray:
int rows=2, cols=2; mxArray *cell_array_ptr; /* Create a 2-by-2 cell mxArray named Paramecium. */ cell_array_ptr = mxCreateCellMatrix(rows, cols); mxSetName(cell_array_ptr, "Paramecium"); ...For an additional example, see
mxCreateCellMatrix.c in the mx subdirectory of the examples directory. For an example of how to populate a cell mxArray, see mxCreateCellArray.
mxCreateCellArray