How to show left over elements from array ?

3 vues (au cours des 30 derniers jours)
Sunson29
Sunson29 le 7 Juin 2019
Commenté : Sunson29 le 7 Juin 2019
Dear friends,
Lets assume i have target = [1 1 2 3 5 8 5 7 5 8 2 2 8], and another array is deleteElm=[3 5 7 8].
Now, I want to delete the elements in "deleteElm" from " target", and show left over elements without repeatition. So, the final out put will be [1 2], since 3 5 7 8 are the elements should be deleted in "target". Is there an efficiency way to do it? Thanks

Réponse acceptée

Walter Roberson
Walter Roberson le 7 Juin 2019
setdiff(target, deleteElm)

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by