sparse

Core Math

Convert a dense matrix to sparse representation. Returns a tagged object with row/col/value entries for nonzero elements.

Syntax

sparse(A)

Examples

sparse([1, 0; 0, 2])
▶ Run
S = sparse(eye(3))
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.