www.gusucode.com > stats 源码程序 matlab案例代码 > stats/AlterPropertiesOfAkDTreeObjectExample.m

    %% Alter Properties of |KDTreeSearcher| Model
%%
% Load Fisher's iris data set.

% Copyright 2015 The MathWorks, Inc.

load fisheriris
X = meas;
%%
% Grow a default four-dimensional _K_ d-tree using the entire data set as training data.  
Mdl = KDTreeSearcher(X)
%%
% Specify that the neighbor searcher use the Minkowski metric to compute
% the distances between the training and query data.
Mdl.Distance = 'minkowski'
%%
% Pass |Mdl| and the query data to either |knnsearch| or |rangesearch| to find
% the nearest neighbors to the points in the query data using the
% Minkowski distance.