find guite the same elements
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Más respuestas (1)
Elad
el 1 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!