MATLAB: Removing repeated values entirely from a vector

vector

Hello all, I have a vector that I want to have all repeated values completely removed. i.e if I had [1 1 2 3 4 4 5] i want to end up with just [2 3 5] Thanks

Best Answer

One approach:
V = [1 1 2 3 4 4 5];
[Vu,~,ic] = unique(V);
T = accumarray(ic, 1);
Out = Vu(T == 1)
Out =
2 3 5