title: Find the point on a curve which is closest to a given point
body: <p><a href="https://i.stack.imgur.com/rkQKW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rkQKW.jpg" alt="enter image description here"></a></p>
  
  <p>I have a curve cutting through my mesh in 2D. It is a moving to the front with time. I have set of points on this curve (front) and my nodes on the mesh. At each time step I need to find which point on the curve (front) is closest to the nodes on my mesh. In other words for each node in my mesh I would like to know which point on the curve is closest to it. Is there a built in MATLAB function to search for this ? (I am using MATLAB environment)  </p>
  
  <p>In the figure the question would be which one is the closest black circle to any of the yellow squares.</p>