spones
Replaces non zero sparse matrix elements with ones.
📝Syntax
s = spones(S)
📥Input Arguments
Parameter Description
S Sparse or 2D matrix.
📤Output Arguments
Parameter Description
S a sparse matrix.
📄Description

s = spones(S) returns a matrix s with the same sparsity structure as S, but with one's in the nonzero positions.

💡Examples
S = sparse([1,0;3,4]);
R = spones(S)
🔗See Also
speyesparse
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub