vector element extraction

1 Ansicht (letzte 30 Tage)
Raviteja
Raviteja am 13 Feb. 2012
>> 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]

Akzeptierte Antwort

Friedrich
Friedrich am 13 Feb. 2012
Hi,
try setdiff:
setdiff(S,C)

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by