필터 지우기
필터 지우기

How to remove redundant rows in a matrix

조회 수: 3 (최근 30일)
Kyle
Kyle 2014년 8월 18일
답변: Guillaume 2014년 8월 18일
Suppose a matrix
1 2
3 4
5 6
3 4
5 7
4 3
row 2, 4, 6 are redundant, so how can I just leave either of them, then the matrix writes
1 2
3 4
5 6
5 7
The actual matrix is quite large, so I will need an automatic routine. Thank you for all suggestions.

채택된 답변

Guillaume
Guillaume 2014년 8월 18일
If the order of the elements in a row does not matter (i.e row 6 == row 4):
unique(sort(m, 2), 'rows')
is what you want. If it does, it's just:
unique(m, 'rows')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by