필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

spliting a vector based on another vector

조회 수: 1 (최근 30일)
John Kim
John Kim 2016년 11월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
Dear all, I have two vectors, A and B. I want to split A into two vectors, C1 and C2, where C1 contains elements of A that are also in B and C2 contains elements of A that are NOT in B. Clearly, I can do C1 = intersect(A,B); C2 = setdiff(A,C1); but it looks cumbersome. Is there a one liner, something like [C1,C2] = f(A,B)? I'd much appreciate any and all help. Thanks so much! Best, John

답변 (1개)

Matt J
Matt J 2016년 11월 10일
편집: Matt J 2016년 11월 10일
Is there a one liner, something like [C1,C2] = f(A,B)?
There will be once you write such a function f(), which you can easily do!

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by