Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Remove repeated row in a matrix (specially zero's repeated row)

조회 수: 1 (최근 30일)
Anusha
Anusha 2013년 11월 4일
마감: MATLAB Answer Bot 2021년 8월 20일
a =
1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0
Remove the repeated zero row.
I want this output
b=
1 4 6
0 0 0
6 7 3
3 1 2
  댓글 수: 1
Anusha
Anusha 2013년 11월 5일
편집: Anusha 2013년 11월 5일
ADD part
a=
[1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0
1 0 0]
b=
1 4 6
0 0 0
6 7 3
3 1 2
1 0 0

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 4일
편집: Azzi Abdelmalek 2013년 11월 5일
EDIT
a = [1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0]
idx=find(~any(a,2))
a(idx(2:end),:)=[]
  댓글 수: 4
Anusha
Anusha 2013년 11월 5일
Please see ADD part
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 5일
편집: Azzi Abdelmalek 2013년 11월 5일
Ok, try this
idx=find(~any(a,2))
a(idx(2:end),:)=[]

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by