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!