| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" size_t mxGetNumberOfElements(const mxArray *pm);
mwPointer mxGetNumberOfElements(pm) mwPointer pm
Number of elements in the specified mxArray
mxGetNumberOfElements tells you how many elements an array has. For example, if the dimensions of an array are 3-by-5-by-10, mxGetNumberOfElements returns the number 150.
Note Fortran does not have an equivalent of size_t. mwPointer is a preprocessor macro that provides the appropriate Fortran type. The value returned by this function, however, is not a pointer. |
See findnz.c and phonebook.c in the matlabroot/extern/examples/refbook folder .
Additional examples:
explore.c in the matlabroot/extern/examples/mex folder
mxcalcsinglesubscript.c, mxgeteps.c, mxgetinf.c, mxisfinite.c, and mxsetdimensions.c in the matlabroot/extern/examples/mx folder
mxGetDimensions, mxGetM, mxGetN, mxGetClassID, mxGetClassName
![]() | mxGetNumberOfDimensions (C and Fortran) | mxGetNumberOfFields (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |