Find unique number sets
조회 수: 4 (최근 30일)
이전 댓글 표시
Given a 2D matrix, I'd like to find the number of rows with unique sets of numbers. For example:
A = [1 4;
2 3;
3 2;
1 4];
The "unique sets" matrix return should be:
B = [1 4;
2 3];
and the indices of these should be
iA = [1 2];
Using unique(A,'rows') sees [2 3] and [3 2] as unique, but I want to consider them as non-unique.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Les Beckham
2022년 8월 4일
편집: Les Beckham
2022년 8월 4일
A = [1 4;
2 3;
3 2;
1 4];
B = unique(sort(A, 2), 'rows')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!