Delet zeros after final number
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
更多回答(1 个)
Mikhail
2014-9-25
There are plenty of ways to do that. For instance, find(A) will find indexes of all nonzero elements. So you can write:
B= A(1:max(find(A)))
max(find(A)) - index of the last nonzero element in A
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!