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

 Respuesta aceptada

Star Strider
Star Strider el 15 de Abr. de 2018
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

2 comentarios

Kareem Al-Qadi
Kareem Al-Qadi el 15 de Abr. de 2018
Thanks!
Star Strider
Star Strider el 15 de Abr. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Abr. de 2018

Comentada:

el 15 de Abr. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by