How do I write a sparse matrix in MATLAB
이전 댓글 표시
답변 (2개)
Daniel Pollard
2020년 12월 15일
편집: Daniel Pollard
2020년 12월 15일
2 개 추천
https://uk.mathworks.com/help/matlab/ref/full.html
댓글 수: 4
Shlesha Van
2020년 12월 15일
Daniel Pollard
2020년 12월 15일
An ellipsis ... has a very specific meaning in Matlab. If you type it in, it interprets that to mean "the next line is a continuation of this line". It does not mean "fill in the numbers here". A sparse matrix is a specific thing, and if you try to enter exactly the A in your question into Matlab, you'll have a bad time. I recommend reading the documentation to get a clearer idea of what's going on.
Shlesha Van
2020년 12월 15일
Jan
2020년 12월 16일
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
Jan
2020년 12월 15일
2 개 추천
You want to convert a sparse matrix into a full one? Then use the command: full().
카테고리
도움말 센터 및 File Exchange에서 Sparse Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

