MATLAB: Check if there are repeated elements in a vector

checkelementsrepetedsamevector

Hi to all, is there a command to check if there are repeated elements in a vector; I just have to check in an "if"…
thanks a lot
Max

Best Answer

if length(v) == length(unique(v))
% There are no repeats.
.......