Contents Previous Next Subchapters

Number of Nonzero Elements
Syntax nnz(x)
See Also any , all , find , equality

Description
Returns the number of element of x that are not equal to zero where x is a logical, character, integer, real, double-precision or complex matrix.

Example
If you enter
     x = identity(5)
     nnz(x)
O-Matrix will reply
     5