substract array elements based on other arrays

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

 Akzeptierte Antwort

Torsten
Torsten am 12 Apr. 2020

1 Stimme

setdiff(All,union(R1,R2))

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 12 Apr. 2020

Kommentiert:

am 12 Apr. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by