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.

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-6-7
out = A(all(A,2),:);
or
out=A;
out(any(A==0,2),:) = [];
  2 个评论
Anthony Mukanya
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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by