Assume I have two sets of matrix (A and B), inside each matrix contains few point coordinates, I want to find out point in B nearest to A and output a cell array C listed the nearest point pair coordinates accordingly and one cell array D register the unpaired spot, how should I do it?
To be more specific, here is what I want
Two sets of matrix contain spot xy coordinates;
A=[ 1 2; 3 4]; B=[1 3; 5 6; 2 1];
want to get C{1,1}=[1 2; 1 3]; C{2,1}= [3 4; 5 6]; D{1,1}=[2 1];
Thanks for the help.