Quick method to find duplicates in a matrix?
显示 更早的评论
Hi guys,
Does anybody know a quick way of checking to see which elements of a matrix are duplicates?
Such as:
a = [1,2,3,4,5,5,1,6,7];
Can we have matlab return the indices of all 1's and 5's or return: 1, 5
Thanks!
1 个评论
José-Luis
2014-7-16
What is an element is repeated more than two times?
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2014-7-16
编辑:Azzi Abdelmalek
2014-7-16
a = [1,2,3,4,5,5,1,6,9];
[ii,jj,kk]=unique(a)
out=ii(histc(kk,1:numel(ii))>1)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!