Main Content

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

pm

Pointer to a sparsemxArray

Returns

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 thatpmpoints to a full (nonsparse)mxArray.

Description

UsemxGetNzmaxto get the value of thenzmaxfield. Thenzmaxfield holds an integer value that signifies the number of elements in their,公关, and, if it exists, thepiarrays. The value ofnzmaxis always greater than or equal to the number of nonzero elements in a sparsemxArray. In addition, the value ofnzmaxis 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 sparsemxArray, MATLAB®software often adjusts the value of thenzmaxfield. MATLAB adjustsnzmaxto reduce the number of costly reallocations and to optimize its use of heap space.

Examples

See these examples inmatlabroot/extern/examples/mx:

See Also

mxSetNzmax

Version History

Introduced before R2006a