Main Content

mxGetNumberOfElements (Fortran)

Number of elements in numeric mxArray

Fortran Syntax

#include "fintrf.h"
mwPointer mxGetNumberOfElements(pm)
mwPointer pm


mxGetNumberOfElements returns the number of elements in the specified mxArray, returned as the appropriate Fortran type. For example, if the dimensions of an array are 3-by-5-by-10, then mxGetNumberOfElements returns the number 150.


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.

Input Arguments

expand all

Pointer to an mxArray array, specified as mwPointer.


See these examples in matlabroot/extern/examples/mx:

Introduced before R2006a