I have an array R3. I need to eliminate those elements of R3 which are present in another, smaller array. Is there an easy method to do this?

1 commentaire

Stephen23
Stephen23 le 4 Jan 2018
Modifié(e) : Stephen23 le 4 Jan 2018
"Is there an easy method to do this?"

Connectez-vous pour commenter.

 Réponse acceptée

Jan
Jan le 4 Jan 2018
Modifié(e) : Jan le 4 Jan 2018

1 vote

setdiff replies all elements of a vector, which do not appear in a second one:
R3 = setdiff(R3, smallerArray);
Or
R3 = R3(~ismember(R3, smallerArray))

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by