The knnsearch function is a classifier.
For points defined by (x,y) coordinates, the pdist (or pdist2) functions would likely be most appropriate. These functions will give you the distances. You then need to threshold them to find the points that meet your criteria.
