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 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!