I have a matrix with one column like this:
NNN
NNN
NNN
AAA
AAA
CCC
CCC
DDD
DDD
DDD
I would like to remove all the lines in which I don’t have 3 repetitions. This would result in removing lines 4,5,6,7 (and the result would be only the matrix with the remaining:
NNN
NNN
NNN
DDD
DDD
DDD
(PS: Those are strings, not numbers).
Is there an inteligent way to do that using matlab? I mean, using the functions and etc? Because I solved the problem with a for, but I think it is not the best way to do it and that it must have another way.
Thanks for the help in advance! 🙂
This should do it:
I assume here that x is a cell matrix with one column of strings. If x has other columns it is an easy fix.