MATLAB Application Program Interface Reference | Help Desk |
mxIsCell
True if a cellmxArray
#include "matrix.h" bool mxIsCell(const mxArray *array_ptr);array_ptr
true
if array_ptr
points to an array having the class mxCELL_CLASS
; otherwise, returns false
.
Use mxIsCell
to determine if the specified array is a cell array.
Do not confuse a cell array with a cell element. Remember that a cell array contains various cell elements, and that most cell elements are not cell arrays.
Consider a MEX-file that expects its first input argument to be a cell array. If it is not a cell array, the MEX-file issues an error message.
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]) { if (mxIsCell(prhs[0])) { /* ... Yes, it is a cell array. */ } else /* No, this is not a cell array. */ mexErrMsgTxt("You must specify a cell array."); }For an additional example, see
mxIsCell.c
in the mx
subdirectory of the examples
directory.
mxIsClass