Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: shifting data within a vector
Date: Mon, 5 May 2008 23:35:00 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fvo5j4$2dt$1@fred.mathworks.com>
References: <fvo3dr$8qk$1@fred.mathworks.com> <fvo564$i8p$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210030500 2493 172.30.248.37 (5 May 2008 23:35:00 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 5 May 2008 23:35:00 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:466802



"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in 
message <fvo564$i8p$1@fred.mathworks.com>...
>   First of all, you don't need 'find' here.  Just use the index returned by max:
> 
>  [mx,ix] = max(s); % ix is the index of the maximum element of x
> 
>   The rest of what you are asking is rather hard to interpret.  Your misuse 
of 
> the word 'raw' is confusing!  My guess is that, starting with ix+1, you wish 
to 
> place mx+10, mx+20, ..., in ix+1, ix+2, etc., on to the end of s.  Is that it?
> 
>  s(ix+1:end) = mx+(10:10:10*(length(s)-ix))';
> 
> Roger Stafford
-------
  After looking at your wordage again, it seems possible that what you 
actually want is this:

 [mx,ix] = max(s); % ix is the index of the maximum element of x
 s(ix+1:end) = s(ix+1:end) + mx+(10:10:10*(length(s)-ix))';

Roger Stafford