You can try Origin's Hierarchical Cluster Analysis tool. Select Statistics: Multivariate Analysis: Hierarchical Cluster Analysis from Origin menu. Choose Dissimilar Matrix in Quantities branch of the dialog. It will create the distance matrix. And replace the diagonal element of the distance matrix 0 with missing value to exclude itself. You can use LabTalk script to do it. (Recalculate set None.)
int nc = wks.ncols;
for( int ii=2; ii<=nc; ii++ )
{
wcol(ii)[ii-1]=0/0;
}
Then you can choose Statistics: Descriptive Statistics: Statistics on Columns from menu. And select all columns of distance matrix as input, and check Index of Minimum in Quantities to Compute: Quantities from the dialog.
Index of Minimum in the report is the point which corresponds to the nearest neighbor.
Note that if number of points n is too large, then the distance matrix with size of n*n may be out of memory. In that case, you have to use LabTalk code or Origin C code to avoid the size limit of distance matrix.
Sam
OriginLab Technical Services