How removing elements from vector?

7 visualizaciones (últimos 30 días)
huda nawaf
huda nawaf el 9 de Ag. de 2022
Comentada: huda nawaf el 10 de Ag. de 2022
Hello,
How removing some elements from a long vector.
For example:
c=[1 2 3];
z=[10 9 1 4 11 2 6 3];
How removing c from z?
Tjanks in advance

Respuesta aceptada

Stephen23
Stephen23 el 9 de Ag. de 2022
Editada: Stephen23 el 9 de Ag. de 2022
c = [1,2,3]
c = 1×3
1 2 3
z = [10,9,1,4,11,2,6,3]
z = 1×8
10 9 1 4 11 2 6 3
x = setdiff(z,c,'stable')
x = 1×5
10 9 4 11 6
or
z(ismember(z,c)) = []
z = 1×5
10 9 4 11 6

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by