Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!s9g2000prm.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:58:42 -0800 (PST)
Organization: http://groups.google.com
Lines: 21
Message-ID: <626a201d-04a2-4304-a3ef-2e89da6f7ef3@s9g2000prm.googlegroups.com>
References: <gimkuq$l7u$1@fred.mathworks.com> <gimmhe$9v$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 1229907522 17384 127.0.0.1 (22 Dec 2008 00:58:42 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 22 Dec 2008 00:58:42 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: s9g2000prm.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:508262


On Dec 22, 1:21=A0pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> "Conrad Andrew" <conr...@gmx.net> wrote in message <gimkuq$l7...@fred.mat=
hworks.com>...
> > .......
> > I want to be able to find the index of the first closest match to 6 wit=
hin the matrix given a specific index to start the search from.
> > ......
>
> =A0 When I see two superlatives specified for a single entity, it always =
raises a warning flag. =A0In your particular case the obvious question is, =
"what makes you think the 'the closest' will be 'the soonest'?" =A0How do y=
ou balance between how close a match the two sets of six have as compared w=
ith how far apart in the list they occur?
>
> Roger Stafford

Yes, Roger, I thought of that too, but try this:
[dmn,imn]=3Dmin(abs([rand(10,1);6;rand(10,1);6;rand(10,1)]-6))

It always gets the first one.