MATLAB Answers

substract array elements based on other arrays

조회 수: 1(최근 30일)
Mo H
Mo H 12 Apr 2020
댓글: Mo H 12 Apr 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

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 12 Apr 2020
setdiff(All,union(R1,R2))

  댓글 수: 1

Mo H
Mo H 12 Apr 2020
Thank you

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by