nnz
The number of non-zero elements in a matrix.
(nz)=nnz(a)
Inputs
a Any matrix.
Outputs
nz The number of non-zero entries in the matrix.


Example
>>a=rand(5,3)
>>nnz(a)
        15
>>nnz(a(find(a>.5))=0)
         7
>>b=sprand(100,50,.1)
>>nnz(b)
       500