replacing a number

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

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 10 de En. de 2012

0 votos

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
>>

5 comentarios

FIR
FIR el 10 de En. de 2012
andrei can u tell how to process this please ,struck here for long
http://www.sendspace.com/file/scymbl
FIR
FIR el 10 de En. de 2012
andrei ur equation returns error for value F having more than 1 column
??? Error using ==> setdiff at 51
A and B must be vectors or 'rows' must be specified.
Error in ==> new at 81
D1=setdiff(F,D)
Andrei Bobrov
Andrei Bobrov el 10 de En. de 2012
setdiff(F(:),D)
FIR
FIR el 10 de En. de 2012
thanks andrei can u answer to my other question which i posted
FIR
FIR el 10 de En. de 2012
andrei i get answer for 1column but not for other columns

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Engines & Motors en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

FIR
el 10 de En. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by