I have an array A
as follows:
A = [7 7 10 10 10 15 1 1 15 15 7 16 17 1 18]. ';
How can I obtain all numbers which occur more than one times in my array? In this example the answer should be 1 7 10 15
.
I have an array A
as follows:
A = [7 7 10 10 10 15 1 1 15 15 7 16 17 1 18]. ';
How can I obtain all numbers which occur more than one times in my array? In this example the answer should be 1 7 10 15
.
Here's another approach, just for variety:
[~, ind] = unique(A);
result = A;
result(ind) = [];
result = unique(result);
Solved it by using the following code
[ii,jj,kk]=unique(A);
repeated=ii(histc(kk,1:numel(ii))>1);