Greetings, suppose Column A has these values - 7 18 27 42 65 49 54 65 78 82 87 98
Is there a way to compare the values (row by row) and search for duplicates? (I'm using Matlab R2010b)I don't want the duplicated values to be removed.
Thanks.
No products are associated with this question.
A = [7 18 27 42 65 49 54 65 78 82 87 98]; [n, bin] = histc(A, unique(A)); multiple = find(n > 1); index = find(ismember(bin, multiple));
Now the values A(index) appear mutliple times.
Here's a slightly different way:
X = [1 2 3 4 5 5 5 1];
uniqueX = unique(X); countOfX = hist(X,uniqueX); indexToRepeatedValue = (countOfX~=1);
repeatedValues = uniqueX(indexToRepeatedValue) numberOfAppearancesOfRepeatedValues = countOfX(indexToRepeatedValue)
Is there a way that I can use this approach for a cell array. Suppose I have a 1x4 cell array and each cell contains a (x,y) co-ordinates. Can I somehow modify your solution to search for duplicate cells and get rid of them?
0 Comments