deleting values from an array

5 visualizzazioni (ultimi 30 giorni)
SSG_newbiecoder
SSG_newbiecoder il 4 Gen 2018
Modificato: Stephen23 il 4 Gen 2018
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 Commento
Stephen23
Stephen23 il 4 Gen 2018
Modificato: Stephen23 il 4 Gen 2018
"Is there an easy method to do this?"

Accedi per commentare.

Risposta accettata

Jan
Jan il 4 Gen 2018
Modificato: Jan il 4 Gen 2018
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))

Più risposte (0)

Categorie

Scopri di più su Operators and Elementary Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by