| MATLAB Function Reference | ![]() |
Syntax
S = spalloc(m,n,nzmax)
Description
S = spalloc(m,n,nzmax)
產生一大小為 m*n
且全為 0 的稀疏矩陣 S。當非零元素增加時,矩陣可以經由一行接著一行產生,而不用重覆的產生空間。
spalloc(m,n,nzmax) 為 sparse([],[],[],m,n,nzmax)
簡略的表達方式。
Examples
S = spalloc(n,n,3*n);
for j = 1:n
S(:,j) = [zeros(n-3,1)' round(rand(3,1))']';
end
| soundsc | sparse | ![]() |