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.

 채택된 답변

Star Strider
Star Strider 2017년 5월 30일

0 개 추천

One approach:
A=[0 0 1 1];
B=[0];
ia = ismember(A,B);
C = A(~ia)
C =
1 1

댓글 수: 2

dario cecchetti
dario cecchetti 2017년 5월 30일
Thank you very much!!!!!!!!
Star Strider
Star Strider 2017년 5월 30일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

태그

질문:

2017년 5월 30일

댓글:

2017년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by