remove cell values of a column vector not contained in another column vector

2 visualizaciones (últimos 30 días)
Micangi
Micangi el 26 de Mzo. de 2021
Comentada: Rik el 27 de Mzo. de 2021
I have two column vectors:
A=[1; 2; 3; 4; 5; 6]
B=[1; 3; 4; 6]
I would like to obtain a column vector that cointain only the cell values of A not contained also in B and, therefore:
C=[2; 5]
I don't want to use loop function beacause I've to analyse huge vectors.

Respuestas (1)

Rik
Rik el 26 de Mzo. de 2021
Editada: Rik el 26 de Mzo. de 2021
doc ismember
And maybe setdiff will do the trick as well.
  2 comentarios
Rik
Rik el 27 de Mzo. de 2021
What did you try? Show us the code you tried. Simply using the ismember function directly on your two example vectors will be almost all you need already.

Iniciar sesión para comentar.

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by