Removing repeated values entirely from a 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

 Accepted 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

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!