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

    %% Train an SVM Classifier
%%
% Find a line separating the Fisher iris data on versicolor and virginica
% species, according to the petal length and petal width measurements.
% These two species are in rows 51 and higher of the data set, and the
% petal length and width are the third and fourth columns.

% Copyright 2015 The MathWorks, Inc.

load fisheriris
xdata = meas(51:end,3:4);
group = species(51:end);
svmStruct = svmtrain(xdata,group,'ShowPlot',true);