Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 10 Jul 2007 11:33:51 -0500
From: "Viðarr" <g-w-bush-is-the-antichrist@nd-is-destroying-the-us.gov>
Newsgroups: comp.soft-sys.matlab
References: <ef5cd86.-1@webcrossing.raydaftYaTP> <1183974225.442027.51510@i38g2000prf.googlegroups.com> <ef5cd86.1@webcrossing.raydaftYaTP>
Subject: Re: Find beginning of epoches
Date: Tue, 10 Jul 2007 09:32:47 -0700
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-RFC2646: Format=Flowed; Original
Message-ID: <QuedndxFj4ltKQ7bnZ2dnUVZ_jSdnZ2d@speakeasy.net>
Lines: 46
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 216.231.36.134
X-Trace: sv3-YLIP4fO4pyRWFQdhc6KR+2xg08B+KVJSPhFJQjD1MTp1x0YU1AOVP9gWdARy3WTg1JaEKjg+ZDXoan+!Ud3iuQMPFWT303WH+rLHlJBlqgcM74/if2oCZLrR0nE5b8H1lUfCJmWawyoOhkemUmZPKCjd/wHS!hVEu+tR2IrwVlIJC/lMdhzzyiLchgw0jb32lj7k=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.35
Bytes: 2172
Xref: news.mathworks.com comp.soft-sys.matlab:418298




"kai voges" <kai.voges@gmx.net> wrote in message 
news:ef5cd86.1@webcrossing.raydaftYaTP...
> Ok, I see! Normaly we say sweep; but maybe this also isn´t clear!
>
> It is a vector like
> a = [0 3 10 40 50 75 90 102 110 120];
> sec.
> Now there occurs an event at
> b = 51;
> sec.
> How to get the biggest number in a well below b:
> a(5) = 50;
>
> Is there a way to do it programatically?
> Thx, Kai


% Another way might be to do it using "find":

idx = find(a <= b);

epoch = a(max(idx));

sprintf('\n\ta(%d) = %f\n',idx,epoch)

ans =


     a(5) = 50.000000


% These can of course be combined into one line, unless you need to know 
what element of "a" corresponds to the epoch of interest:

epoch = a(max(find(a <= b)));

% For further information:
help find
help max



Viðarr