removing zeros from a matrix
3 ビュー (過去 30 日間)
古いコメントを表示
Hey I have a matrix x=[1;2;0;0;0;3;4;5;0;6;0;4;0;6;3;2;1;1;0]; how do I remove the zeros from this matrix?
0 件のコメント
採用された回答
David Fletcher
2018 年 4 月 3 日
x(x==0)=[]
2 件のコメント
David Fletcher
2018 年 4 月 3 日
編集済み: David Fletcher
2018 年 4 月 3 日
No, just the value of 0. If you need to remove the zeros in everything, it might be easier to convert it to a string, remove the zero characters, and then convert it back to numbers
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!