find guite the same elements
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Elad
am 1 Jun. 2012
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 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!