MATLAB Function Reference Previous page   Next Page
spalloc

Allocate space for sparse matrix

Syntax

Description

S = spalloc(m,n,nzmax) creates an all zero sparse matrix S of size m-by-n with room to hold nzmax nonzeros. The matrix can then be generated column by column without requiring repeated storage allocation as the number of nonzeros grows.

spalloc(m,n,nzmax) is shorthand for

Examples

To generate efficiently a sparse matrix that has an average of at most three nonzero elements per column


Previous page  soundsc sparse Next page

© 1994-2005 The MathWorks, Inc.