vector element extraction

조회 수: 2 (최근 30일)
Raviteja
Raviteja 2012년 2월 13일
>> S=[8 4 1 6 7 2 1 5 0 5 1];
>> C=[1 0 5 8];
I want to remove all the elements in S which are in C. In otherwords, I want to extract all the elements in S which are already in C.
i.e.,
My output have to look like
>>ans= [4 6 7 2]

채택된 답변

Friedrich
Friedrich 2012년 2월 13일
Hi,
try setdiff:
setdiff(S,C)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by