%含有大量0元素的矩阵成为稀疏矩阵n=10;S = sparse(1:n,1:n,1)[i,j,s] = find(S);[m,n] = size(S);S = sparse(i,j,s,m,n);
楼上正解,学习了