Number of non-zero elements.
nnz(x)
x
a numeric or complex vector or matrix.
the number of non-zero elements of x.
find
nnz(diag(10))