substract array elements based on other arrays

1 vue (au cours des 30 derniers jours)
Mo H
Mo H le 12 Avr 2020
Commenté : Mo H le 12 Avr 2020
Hi,
I have three arrays.
The first one contain all numbrs that need to be studied, All = [1,2,3,4,5,6,7,8,9,10]
The other arrays contains the numbers that need to be retained, R1 = [8,9,10], R2 = [5]
I want the result to be (All - R1 - R2) which is equal to [1,2,3,4,6,7].
Your help is highly appreicated

Réponse acceptée

Torsten
Torsten le 12 Avr 2020
setdiff(All,union(R1,R2))

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by