From: Jack Daniels on 22 Mar 2010 00:19 Hi, just need a little help, I have no idea how to go about this. If i was given an arbitrarily sized row vector, [1 18 4 5 9 14 11] in this case. How would I identify all the values that are bigger than 9, subtract 10 from them and add 1 onto the previous value in the row? Thanks =)
From: us on 22 Mar 2010 04:21 "Jack Daniels" <maxxyA2_bmx(a)hotmail.com> wrote in message <ho6r3o$2bk$1(a)fred.mathworks.com>... > Hi, just need a little help, I have no idea how to go about this. > If i was given an arbitrarily sized row vector, [1 18 4 5 9 14 11] in > this case. How would I identify all the values that are bigger than 9, > subtract 10 from them and add 1 onto the previous value in the row? > Thanks =) one of the many solutions v=[1 18 4 5 9 14 11]; ix=find(v>9); v(ix)=v(ix)-1; ix=ix-1; v(ix)=v(ix)+1; us
From: Jack Daniels on 22 Mar 2010 05:12 "us " <us(a)neurol.unizh.ch> wrote in message <ho799g$5u4$1(a)fred.mathworks.com>... > "Jack Daniels" <maxxyA2_bmx(a)hotmail.com> wrote in message <ho6r3o$2bk$1(a)fred.mathworks.com>... > > Hi, just need a little help, I have no idea how to go about this. > > If i was given an arbitrarily sized row vector, [1 18 4 5 9 14 11] in > > this case. How would I identify all the values that are bigger than 9, > > subtract 10 from them and add 1 onto the previous value in the row? > > Thanks =) > > one of the many solutions > > v=[1 18 4 5 9 14 11]; > ix=find(v>9); > v(ix)=v(ix)-1; > ix=ix-1; > v(ix)=v(ix)+1; > > us
|
Pages: 1 Prev: Plotting - Not all of them are plotted Next: program on image processing |