The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 simple nearest neighbor

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ifsmithy Posted - 06/27/2013 : 2:01:39 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System:XP

I was wondering how I go about a simple nearest neighbor analysis.

I have a pretty long column of x and y coordinates and I would like to be able to calculate the distance each coordinate is to it's nearest neighbor.

Is there a simple way to do this in origin?

Many Thanks!
1   L A T E S T    R E P L I E S    (Newest First)
Sam Fang Posted - 06/28/2013 : 02:43:56 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000