How can I remove duplicate values
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi! I want remove duplicate values of array 'positions' where the corresponding value of d is lower.
Example:
[positions,d]=dsearchn(X,Y);
positions = 1 1 2 3 5 6 7 9 12 13 15 16
d= 235 386 189 67 158 266 180 92 187 191 156 194
In this case I want exclude the second position and obtain d= 235 189 67 158 266 180 92 187 191 156 194
Thanks, Appreciate the help !
댓글 수: 0
답변 (1개)
Walter Roberson
2017년 4월 21일
[~, ~, uidx] = unique(positions, 'stable');
positions(uidx)
d(uidx)
댓글 수: 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!