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 Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by