Prev: rounding particle value using PSO
Next: Contourf
From: Husam Aldahiyat on 22 Mar 2010 06:00 "Sam " <sam.watts60(a)ntlworld.com> wrote in message <ho7e37$mnn$1(a)fred.mathworks.com>... > Hi all, > > I need to write a code for adding two vectors of different length, e.g. x=[1 9 8] and y=[2 0 4 9], treating the row vectors as integers. Any help will be appreciated. >> bsxfun(@plus,x,y')
From: Sam on 22 Mar 2010 06:24 I have a first line for my function function res=MyAdd (x,y) not really sure where to go after this
From: Husam Aldahiyat on 22 Mar 2010 06:33 function res = MyAdd (x,y) a = [zeros(1,length(x)-length(y)),y]; b = [zeros(1,length(y)-length(x)),x]; res = str2num(reshape([(num2str(a+b));... repmat(' ',1,length((num2str(a+b))))],1,[])); end
From: us on 22 Mar 2010 06:35 "Sam " <sam.watts60(a)ntlworld.com> wrote in message <ho7gg3$5ht$1(a)fred.mathworks.com>... > I have a first line for my function > > function res=MyAdd (x,y) > > not really sure where to go after this that is not a lot... did you come up with an example as you were told(?)... us
From: Sam on 22 Mar 2010 06:44
"us " <us(a)neurol.unizh.ch> wrote in message <ho7h4o$f52$1(a)fred.mathworks.com>... > "Sam " <sam.watts60(a)ntlworld.com> wrote in message <ho7gg3$5ht$1(a)fred.mathworks.com>... > > I have a first line for my function > > > > function res=MyAdd (x,y) > > > > not really sure where to go after this > > that is not a lot... > did you come up with an example as you were told(?)... > > us yes i do have an example x=[1 9 8], y=[2 0 4 9] i have to add them up as if it were [0 1 9 8] and [2 0 4 9] |