remove rows with all zeros

318 次查看(过去 30 天)
I have
a =
1 2 3
0 0 0
2 1 0
4 5 0
0 0 0
2 0 1
I need
b=
1 2 3
2 1 0
4 5 0
2 0 1

采纳的回答

Walter Roberson
Walter Roberson 2012-6-6
b = a(any(a,2),:);
  5 个评论
Mohamed Nedal
Mohamed Nedal 2019-12-20
Hi Walter,
Would you please explain this line?
b = a(any(a,2),:);

请先登录,再进行评论。

更多回答(1 个)

Geoff
Geoff 2012-6-6
Search facility on Answers shows this question is asked a lot... Here's one of the more recent.

类别

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