FUNCTION REFERENCE
nnz
Count nonzero elements.
Count nonzero elements.
Syntax
nnz(A)Returns the number of nonzero elements; for a sparse array, the number of stored entries.
Example
nnz([1 0 2]) % 2Example
nnz(speye(4)) % 4Differences from MATLAB: none known, also for complex input.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.