One method is to calculate pairwise distances using pdist(), and the using mink() to calculate the ten closest points.
x = rand(100,1);
y = rand(100,1);
dists = squareform(pdist([x y]));
dists(dists==0) = inf;
[~, I] = mink(dists, 10, 2);
Matrix I contain 100 rows (equal to the number of points) and ten columns (each entry is the index of the closest point).