nonzeros

Purpose

The nonzero entries in a matrix.

Synopsis

s = nonzeros(X)

Description

s = nonzeros(X) is a full column vector of the nonzero elements in X, ordered by columns.

This gives the s, but not the i and j, from [i,j,s] = find(X). Generally,

length(s) = nnz(X) <=  nzmax(X) <=  prod(size(X))

See Also

find, issparse, nnz, nzmax, size, whos

(c) Copyright 1994 by The MathWorks, Inc.