MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > find nearest,closest value 

Hi, 
megha bhatt wrote: 
Subject: find nearest,closest value From: Roger Stafford Date: 16 Feb, 2009 02:27:01 Message: 3 of 20 
"megha bhatt" <mubhatt19@yahoo.co.in> wrote in message <gmf901$45e$1@fred.mathworks.com>... 
m = size(a,2); n = size(b,2); ?? 
Subject: find nearest,closest value From: Roger Stafford Date: 16 Feb, 2009 06:10:04 Message: 5 of 20 
"Shaun" <s@s.com> wrote in message <gnanne$b6m$1@fred.mathworks.com>... 
Subject: find nearest,closest value From: Matlab Matlab Date: 22 Oct, 2009 00:57:20 Message: 6 of 20 
That's some amazing code, Roger. Thank you for contributing it. Is it a wellknown algorithm, or did you figure it out? 
This is brilliant code. Is there a simple way to extend it for comparison of vectors? 
Subject: find nearest,closest value From: Roger Stafford Date: 9 Oct, 2010 01:10:04 Message: 8 of 20 
"Harry Commin" <hmc05_remove_this_@ic.ac.uk> wrote in message <i8o734$a2d$1@fred.mathworks.com>... 
Delaunay triangulation is usually the best method to find nearest vector 
Subject: find nearest,closest value From: Roger Stafford Date: 9 Oct, 2010 15:59:04 Message: 10 of 20 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i8p8t2$p4c$1@fred.mathworks.com>... 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i8q3g8$o52$1@fred.mathworks.com>... 
Thinking about a little more, even if Delaunay can't be used directly to find L1closest point,it is clearly the candidate points are the those who are connected with the L2closest point by a (L2) Delaunay simplex. This property can be used to reduce the search by computing the L1 distance to few candidates points for a given input points. 
I still need to check whereas the criteria for candidate points works when the points outside the convex hull. But here is what I have in mind: 
Sorry: The criteria I stated earlier is flawed, that means the closest L1 point can be even not connected to closest L2 point by any Delaunay simplex. 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <i8s483$i4a$1@fred.mathworks.com>... 
On Apr 30, 9:51 pm, "Xiaodong " <e20...@gmail.com> wrote: 
Subject: find nearest,closest value From: Roger Stafford Date: 1 May, 2011 05:27:05 Message: 17 of 20 
"Xiaodong" wrote in message <ipiea9$3vr$1@fred.mathworks.com>... 
Subject: find nearest,closest value From: Roger Stafford Date: 1 May, 2011 08:58:04 Message: 18 of 20 
If I were writing that code today instead of two years ago I would probably prefer the simpler: 
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <870e82596b6646b9a101b1fdc568f271@j26g2000yqa.googlegroups.com>... 
"Roger Stafford" wrote in message <ipiqv9$cja$1@fred.mathworks.com>... 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.