vector element extraction

2 次查看(过去 30 天)
>> 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 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by