Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: shifting data within a vector
Date: Tue, 6 May 2008 03:38:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 13
Message-ID: <fvojqr$hlf$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 1210045083 18095 172.30.248.37 (6 May 2008 03:38:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 6 May 2008 03:38:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1376919
Xref: news.mathworks.com comp.soft-sys.matlab:466819



Thank you Roger.  Your first reply answers my question.  
Apologies for the &#8216;raw&#8217; stuff, sometimes this stuff comes 
from the gut instead of the brain.

Here is exactly what I wanted to do, and thanks again for 
your help:

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