Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorize finding upper envelope of vector
Date: Thu, 13 Mar 2008 21:29:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <frc6au$ehp$1@fred.mathworks.com>
References: <frbrrt$n43$1@fred.mathworks.com> <frbvfd$bj4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1205443742 14905 172.30.248.35 (13 Mar 2008 21:29:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 13 Mar 2008 21:29:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1173724
Xref: news.mathworks.com comp.soft-sys.matlab:457138



"Yuri Geshelin" <geshelin@hotmail.com> wrote in message
<frbvfd$bj4$1@fred.mathworks.com>...
> ifi = find(diff(a)<0)
> a(ifi+1)=a(ifi)
> 

Thanks for your reply, however this doesn't work how I want.
Perhaps I didn't explain my problem clearly enough.

I would like each element to be the highest from all
previous elements. 

So, if if 

a=[1 2 3 4 3 2 3 5]

then I would like this to become

[1 2 3 4 4 4 4 5].

Using the code you provided, this would yield

[1 2 3 4 4 3 3 5] which isn't what I after.