R = spones(S)
R = spones(S) generates a matrix R with the same sparsity structure as S, but with 1s in the nonzero positions.
c = sum(spones(S)) is the number of nonzeros in each column.
r = sum(spones(S'))' is the number of nonzeros in each row.
sum(c) and sum(r) are equal, and are equal to nnz(S).
(c) Copyright 1994 by The MathWorks, Inc.