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

 采纳的回答

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

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by