matlab knnsearch code example
Example: nearest neaghbor matlab
Idx = knnsearch([P(1:10,1,1) P(1:10,1,2) P(1:10,1,3)],[P(1,1,1) P(1,1,2) P(1,1,3)],'K',2);
Idx = knnsearch([P(1:10,1,1) P(1:10,1,2) P(1:10,1,3)],[P(1,1,1) P(1,1,2) P(1,1,3)],'K',2);