From: Jack Daniels on
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
"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
"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