필터 지우기
필터 지우기

How can i delete repeated rows?

조회 수: 1 (최근 30일)
Ahmed Hamed
Ahmed Hamed 2016년 8월 3일
편집: Guillaume 2016년 8월 3일
I have a matrix A as follows
A = 1,1,2,3,4
2,1,2,3,4
I'd like to consider that the two rows are identical as the firs column only describes the index, so the output should like
A = 1,1,2,3,4
or
A= 2,1,2,3,4
when I make use of unique(A,'rows') it doesn't consider the two rows are identical
Any help, please.

채택된 답변

Guillaume
Guillaume 2016년 8월 3일
편집: Guillaume 2016년 8월 3일
Use the second return value of unique:
[~, rowstokeep] = unique(A(:, 2:end), 'rows');
newA = A(rowstokeep, :)

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by