MATLAB: Replacing a number

datamining

I have a value D=[1 20]
another value F=[1 3 4 5 6 7 8 ]
no i want to compare two values D and F if value of F is not present in D in should be added to d1 ,i need a for loop.please help

Best Answer

setdiff(F,D)
ADD [13:44(UTC+4) 10.01.2012]
e.g. for every row of array F:
>> D = [1 20];
>> F =[1 3 4 5 6 7 8;
9 10 11 20 16 1 18];
>> out = arrayfun(@(i1)setdiff(F(i1,:),D),1:size(F,1),'un',0)
out =
[1x6 double] [1x5 double]
>> out{:}
ans =
3 4 5 6 7 8
ans =
9 10 11 16 18
>>