remove rows with all zeros

조회 수: 333 (최근 30일)
Rahul
Rahul 2012년 6월 6일
댓글: Shishir Bapat 2021년 3월 11일
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),:);
Shishir Bapat
Shishir Bapat 2021년 3월 11일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (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