FUNCTION REFERENCE

spalloc

All-zero sparse array with room for nonzeros.

All-zero sparse array with room for nonzeros.

Syntax

S = spalloc(m, n, nz)

Returns sparse(m,n). nz must be a nonnegative integer; storage grows when entries are added, so nz is otherwise ignored.

Example

S = spalloc(3, 4, 5)   % All zero sparse: 3x4

Differences from MATLAB: nz does not reserve storage, and nzmax(S) is 0 until entries are stored.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.