How removing elements from vector?

4 vues (au cours des 30 derniers jours)
huda nawaf
huda nawaf le 9 Août 2022
Commenté : huda nawaf le 10 Août 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

Réponse acceptée

Stephen23
Stephen23 le 9 Août 2022
Modifié(e) : Stephen23 le 9 Août 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
  1 commentaire
huda nawaf
huda nawaf le 10 Août 2022
Thank u so much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by