< MATLAB Programming < Arrays

A Sparse Matrix is a matrix that mostly contains zeros. In MATLAB, sparse matrices contrast regular ones in the way they are stored, such that memory is used more efficiently for matrices that are sparse.

A regular matrix can be converted to a sparse matrix using

  >> S = sparse(A);   % Create sparse representation of A

Sparse matrices are very common in engineering purposes. This is useful for manipulation as most of the matrix has a value of 0.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.