Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news2!postnews.google.com!g39g2000pri.googlegroups.com!not-for-mail
From: NZTideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Search matrix for the first closest match
Date: Sun, 21 Dec 2008 16:18:49 -0800 (PST)
Organization: http://groups.google.com
Lines: 26
Message-ID: <3f58445e-d9bc-4693-b589-d0fd0ffbd7fb@g39g2000pri.googlegroups.com>
References: <gimkuq$l7u$1@fred.mathworks.com>
NNTP-Posting-Host: 202.78.152.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1229905129 21578 127.0.0.1 (22 Dec 2008 00:18:49 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 22 Dec 2008 00:18:49 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g39g2000pri.googlegroups.com; posting-host=202.78.152.105; 
	posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) 
	Gecko/2008120122 Firefox/3.0.5,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 bc3
Xref: news.mathworks.com comp.soft-sys.matlab:508258


On Dec 22, 12:54=A0pm, "Conrad Andrew" <conr...@gmx.net> wrote:
> I have a matrix consisting of ephemeris data as below (the ... just means=
 i skipped some data for brevity)
>
> A =3D
> =A0 354.8800
> =A0 357.7500
> =A0 0.6500
> =A0 3.5800
> =A0 6.5600
> =A0 ...
> =A0 352.6400
> =A0 355.7600
> =A0 358.9400
> =A0 0.8900
> =A0 3.7900
> =A0 6.9000 =A0
>
> I want to be able to find the index of the first closest match to 6 withi=
n the matrix given a specific index to start the search from. Can someone s=
how me an easy way to search the matrix? Is there a function that does this=
 search efficiently?
> Thanks!

[dmn,imn]=3Dmin(abs(A(istart:end)-6));
i6=3Dimn + istart - 1;