Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Search matrix for the first closest match
Date: Tue, 21 Jul 2009 02:41:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <h439rv$4ip$1@fred.mathworks.com>
References: <gimkuq$l7u$1@fred.mathworks.com> <gimmhe$9v$1@fred.mathworks.com> <626a201d-04a2-4304-a3ef-2e89da6f7ef3@s9g2000prm.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248144063 4697 172.30.248.38 (21 Jul 2009 02:41:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 21 Jul 2009 02:41:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1560446
Xref: news.mathworks.com comp.soft-sys.matlab:556986


NZTideMan <mulgor@gmail.com> wrote in message <626a201d-04a2-4304-a3ef-2e89da6f7ef3@s9g2000prm.googlegroups.com>...
> 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.

Thanks for your replies. NZTideMan> This is what I needed. I'm sorry it took about 6months to reply to this. I thought I had done so ages ago!