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

    %% Train Regression Tree
% This example shows how to train a regression tree.
%%
% Create a regression tree using all observation in the |carsmall| data
% set. Consider the |Horsepower| and |Weight| vectors as predictor variables,
% and the |MPG| vector as the response.
load carsmall % Contains Horsepower, Weight, MPG
X = [Horsepower Weight];

Mdl = fitrtree(X,MPG)