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

    %% Grow a _K_ d-tree Using the Minkowski Distance Metric
% Grow a _K_ d-tree that uses the Minkowski distance with an exponent of
% five.
%%
% Load Fisher's iris data set. Create a variable for the petal dimensions.

% Copyright 2015 The MathWorks, Inc.

load fisheriris
x = meas(:,3:4);
%%
% Grow a _K_ d-tree. Specify the Minkowski distance with an exponent of five.
Mdl = createns(x,'Distance','minkowski','P',5)
%%
% Since |x| has two columns and the distance metric is Minkowski,
% |createns| creates a |KDTreeSearcher| model by default.