Create sparse matrix - MATLAB sparse - MathWorks
https://www.mathworks.com/help/matlab/ref/sparse.htmlCreate sparse matrix collapse all in page Syntax S = sparse (A) S = sparse (m,n) S = sparse (i,j,v) S = sparse (i,j,v,m,n) S = sparse (i,j,v,m,n,nz) Description example S = sparse (A) converts a full matrix into sparse form by squeezing out any zero elements. If a matrix contains many zeros, converting the matrix to sparse storage saves memory.