Asked by RDG
on 22 Oct 2011

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.*

Answer by the cyclist
on 22 Oct 2011

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)

Answer by Hannes Greim
on 19 Jan 2013

you can use "tabulate" for cell arrays.

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments