How to do set subtraction
조회 수: 59 (최근 30일)
이전 댓글 표시
I have two array a=[1,2,3] and b=[2,3,4,5]
I need a array c=b\a. Here \ is the set subtract operation. result is as follows:
i.e.c=[4,5]
How to do that in matlab. Thanks in advance.
댓글 수: 0
추가 답변 (1개)
Vishal Rane
2012년 12월 12일
Use
c = b(~ismember(b,a))
although there might be more simpler way to do this.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!