How do I write a sparse matrix in MATLAB

2 views (last 30 days)
Shlesha Van
Shlesha Van on 15 Dec 2020
Commented: Jan on 16 Dec 2020
  2 Comments
Shlesha Van
Shlesha Van on 15 Dec 2020
That gives solutions on how to convert a full matrix into sparse. My case is opposite. I want to convert a sparse into full

Sign in to comment.

Answers (2)

Daniel Pollard
Daniel Pollard on 15 Dec 2020
Edited: Daniel Pollard on 15 Dec 2020
https://uk.mathworks.com/help/matlab/ref/full.html
  4 Comments
Jan
Jan on 16 Dec 2020
The first two inputs of sparse() are the size of the matrix. As the error message tells you, [2,-1,0] cannot be a valid size. See the documentation of sparse :
doc sparse

Sign in to comment.


Jan
Jan on 15 Dec 2020
You want to convert a sparse matrix into a full one? Then use the command: full().

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!