| MATLAB Application Program Interface | Search  Help Desk |
| mxGetNzmax | Examples See Also |
Get the number of elements in the ir, pr, and (if it exists) pi arrays
C Syntax
#include "matrix.h" int mxGetNzmax(const mxArray *array_ptr);
Arguments
array_ptrmxArray.
Returns
The number of elements allocated to hold nonzero entries in the specified sparsemxArray, on success. Returns an indeterminate value on error. The most likely cause of failure is that array_ptr points to a full (nonsparse) mxArray.
Description
UsemxGetNzmax 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 often adjusts the value of the nzmax field. MATLAB adjusts nzmax in order to reduce the number of costly reallocations and in order to optimize its use of heap space.
Examples
Seemxgetnzmax.c and mxsetnzmax.c in the mx subdirectory of the examples directory.
See Also
mxSetNzmax