Reputation: 329
If I have these data: m= {'a' 'b' 'a' 'v'}
how to make an if statement that if I have a repeated values in the row, I should omit this row I have this code but it is not a direct code... I want something more profisional (one line function without for loop !!)
for j=1:length(m)
if isequal(m{1,j},m{1,j+1})
disp('error');
end
end
Upvotes: 1
Views: 6784
Reputation: 9283
Use the unique command. It can also find repeated rows from a matrix http://www.mathworks.se/help/matlab/ref/unique.html#btb0_85
Upvotes: 4