find guite the same elements
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone
I have a mXn matrix called Theseis that it has the above elements in spread around the table and in any other point has 0.
1056 2629
1056 2630
1056 2631
1057 2629
1057 2630
1057 2631
1058 2629
1058 2630
1058 2631
1419 3663
1419 3664
1420 3663
1420 3664
1421 3663
1421 3664
1757 2644
1758 2643
1758 2644
1759 2643
1759 2644
2427 3664
2427 3665
2428 3664
2428 3665
2429 3664
2429 3665
2613 2646
2614 2646
2615 2645
2615 2646
Is there a way to find which elements are the same(except the zeros) or guite the same(eg these are guite the same:
2613 2646
2614 2646
2615 2645
2615 2646
) and delete them and leave only one of each group. eg the new maytix will be
1056 2631
1419 3663
.......................etc
댓글 수: 0
채택된 답변
추가 답변 (1개)
Elad
2012년 6월 1일
let say you have 2 vector A ,B (like your columns there) you can do something like : [C, ia] = unique(A); for k = 1:length(ia) D(k)=B(ia(k)) end then do the same with D with respect to C and you are done. for M x N you can extend this to run on all the columns ..,
댓글 수: 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!