delete rows which contain at least 1 zero
61 次查看(过去 30 天)
显示 更早的评论
Hi there I have a large matrix A. I want to delete every row which contains at least 1 zero in the row.
0 个评论
采纳的回答
Andrei Bobrov
2012-6-7
out = A(all(A,2),:);
or
out=A;
out(any(A==0,2),:) = [];
2 个评论
Anthony Mukanya
2015-8-17
移动:Voss
2024-3-24
Thanks Andrei,
I tried what you suggested and it worked.
Now I would like to know what I should do keep the last row even if it contains a zero. The reason for this is because the entry on the nth row and jth must be zero.
Thanks
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!