difference of two vector
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi everybody, I would like to know how to solve the following problem.
A=[0 0 1 1]
B=[0]
where B has got only one component. ex. My goal is to delete the components A(1 2) automatically and obtaining
C=[1 1].
The 'A' vector is obtained afther for loop,but I don't know how many components are zero and one, while 'B' is known. My goal is to delete the components A(1 2) automatically and obtaining C=[1 1].
Thank you.
댓글 수: 0
채택된 답변
Star Strider
2017년 5월 30일
One approach:
A=[0 0 1 1];
B=[0];
ia = ismember(A,B);
C = A(~ia)
C =
1 1
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!