mxGetNzmax (C and Fortran)
Number of elements in IR, PR, and PI arrays
C Syntax
#include "matrix.h" mwSize mxGetNzmax(const mxArray *pm);
Fortran Syntax
#include "fintrf.h" mwSize mxGetNzmax(pm) mwPointer pm
Arguments
pmPointer to a sparse
mxArray
Returns
Number of elements allocated to hold nonzero entries in the specified sparse
mxArray, on success. Returns an indeterminate value on error. The
most likely cause of failure is that pm points to a full (nonsparse)
mxArray.
Description
Use mxGetNzmax to get the value of the nzmax
field. The nzmax field holds an integer value that signifies the
number of elements in the ir, pr, and, if it
exists, the pi arrays. The value of nzmax is
always greater than or equal to the number of nonzero elements in a sparse
mxArray. In addition, the value of nzmax is
always less than or equal to the number of rows times the number of columns.
As you adjust the number of nonzero elements in a sparse mxArray,
MATLAB® software often adjusts the value of the nzmax field.
MATLAB adjusts nzmax to reduce the number of costly
reallocations and to optimize its use of heap space.
Examples
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","mx","filename")]);
where filename is:
See Also
Version History
Introduced before R2006a