目标:查询目标点附近的10个最近邻邻居。 load fisheriris x = meas(:,3:4); figure(100); g1=gscatter(x(:,1),x(:,2),species); %species分类中是有三个分类:setosa,versicolor,virginica legend('Location','best') newpoint = [5 1.45]; line(newpoint(1),newpoint(2),'marker','x','color','k',... 'markersize',10,'linewidth',2) Mdl = KDTreeSearcher(x) ; [n,d] = knnsearch(Mdl,newpoint,'...... 展开更多