s = spones(S)
| Parameter | Description |
|---|---|
| S | sparse or full 2-D matrix. |
| Parameter | Description |
|---|---|
| s | a sparse matrix with ones at nonzero positions. |
s = spones(S) returns a matrixs with the same sparsity structure asS, but with one's in the nonzero positions.
Double, single, logical, complex double, and complex single sparse inputs are supported. The result is sparse and uses double values except when the sparse numeric input is single, in which case the result keeps class single.
Stored zero values do not become ones; only entries whose value is actually nonzero are kept in the output pattern.
S = sparse([1,0;3,4]);
R = spones(S)
S = sparse([1 2 1 2], [1 1 2 2], single([0 -0 complex(0, 0) complex(0, 2)]), 2, 2, 4);
R = spones(S)
| Version | Description |
|---|---|
| 2.0.0 | extended sparse single and complex single support |
| 1.0.0 | initial version |