| External Interfaces/API Reference | ![]() |
Get number of elements in an array
C Syntax
#include "matrix.h" int mxGetNumberOfElements(const mxArray *array_ptr);
Arguments
array_ptr
Pointer to an mxArray.
Returns
Number of elements in the specified mxArray.
Description
mxGetNumberOfElements tells you how many "pieces" an array has. Use mxGetClassID to find out what the pieces are. These two functions provide the highest-level information about an array.
Examples
See findnz.c and phonebook.c in the refbook subdirectory of the examples directory.
For additional examples, see explore.c in the mex subdirectory of the examples directory; see mxcalcsinglesubscript.c, mxgeteps.c, mxgetinf.c, mxisfinite.c, and mxsetdimensions.c in the mx subdirectory of the examples directory.
See Also
mxGetDimensions, mxGetM, mxGetN, mxGetClassID, mxGetClassName
| mxGetNumberOfDimensions | mxGetNumberOfFields | ![]() |