View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fuzzy CART

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0 | 3 ratings Rate this file 22 Downloads (last 30 days) File Size: 60.1 KB File ID: #28393 Version: 1.0

Fuzzy CART



Generates fuzzy rules of fuzzy inference system (FIS) using CART algorithm and ANFIS training

| Watch this File

File Information

The archive includes genfis4.m that generates Mamdani- and Sugeno-type FIS using CART algorithm to extract fuzzy rule information from data set. It is based mostly on Fuzzy Logic Toolbox but it has required to modify Toolbox's fuzzy rule building principle. As a result some original m-files was adapted for this new fuzzy rule structure. They are marked with the last 'x' symbol and included in the archive (e.g., getfisx.m, evalfisx.m etc.) Though some Toolbox's m-files still work (e.g., addvar.m, plotmf.m etc.)



- before you start you should create MEX files by commands:
mex src/evalfisxmex.c
mex src/anfisxmex.c

- you need Statistics Toolbox to implement CART algorithm;

- if you want to use your own decision tree algorithm you need to rewrite treeinfo.m;

- see example.m for fuzzy CART usage.

Known problems:

- it supports only regression tree without missing values for predictors and the response;

- it doesn't work if the resulting tree consists only one node (leaf);

- if some predictors are encountered in none of the branch nodes you can't use ANFIS training (evalfisx.m still works).

Required Products Fuzzy Logic Toolbox
Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
24 Sep 2016 Iltcho Zarev

No appropriate method, property, or field
'test' for class 'RegressionTree'.

Error in
(line 21)
[varargout{1:nargout}] =

Error in treeinfo (line 47)
[~, ~, ~, bestlevel] =

Error in genfis4 (line 140)
ti = treeinfo(Xin, Xout, varargin{:});

Comment only
10 Oct 2015 fulden cantas

I need someone to help me, please. It's so important for me to take some step for my thesis. I've downloaded this fcart file to 'toolbox' file in program files->matlab->toolbox. then started matlab and tried to apply mex src/anfisxmex.c and mex src/evalfisxmex.c but it doesn't work in r2009a, r2009b and r2015a versions. (error is : C:\PROGRA~1\MATLAB\R2009A\BIN\MEX.PL: Error: 'src/anfisxmex.c' not found.

??? Error using ==> mex at 218
Unable to complete successfully.)

When I ignored this 'mex error' and pasted the codes one by one, it gives another error when the code is: % Generate FIS structure based on CART algorithm
fis_cart = genfis4(Xl, yl, 'sugeno', 'auto', treeopts, tstopts); and it gives the error : ??? Error: File: treeinfo.m Line: 46 Column: 7
Expression or statement is incorrect--possibly unbalanced (, {, or [.

Error in ==> genfis4 at 140
ti = treeinfo(Xin, Xout, varargin{:});

I really need help with this. If someone can help me with this, I really appreciate it. Thanks in advance.

Comment only
06 Apr 2015 Ilias Konsoulas

Very good job! Congrats!

31 May 2013 Mohammad Sultan Mahmud

i am new in anfis and matlab, I'm trying working with recurrent-anfis; please can anyone help me- how can code for feedback output result as input of current structure (Sugeno-type); where i have to change code. i'm waiting for kind reply.

Comment only
29 Dec 2012 nazar dikhil

please Iam need the matlab code of anfismex function

Comment only
10 Jul 2012 Roji

Roji (view profile)

Thank-you Konstantin.

Comment only
10 Jul 2012 Roji

Roji (view profile)

10 Jul 2012 Konstantin Sidelnikov

it would be better if you provided your data set or M-file, for which the described effect is observed.

Comment only
10 Jul 2012 Roji

Roji (view profile)

Dear Konstantin,

Just one question. When running your code on the sample results are very satisfactory. The code works perfectly well. The problem comes when using c_cart and evalfisx with new data (let´s call it newdata, and it is an out of sample data). The outout obtained by "evalfisx(newdata, c_cart)" looks very weird. Why does it happen? The output sample I use to train the fis_cart and c_cart is between 1 and 5, but the out of sample output from c_cart (the new data for the inputs is never above prior up and low bonds) is a high negative number.


Kindest Regards,


Comment only
28 Jun 2012 Roji

Roji (view profile)


Thank-you Konstantin.

Comment only
27 Jun 2012 Konstantin Sidelnikov

Thanks for a positive assessment of my work.
As for your question, Roji, yes, here 2 corresponds to the number of FIS inputs.
Theoretically, the number of inputs can be arbitrary.

Comment only
27 Jun 2012 Roji

Roji (view profile)

Dear Konstantin,

An amazing collection of functions that should be part of the Matlab;s suite for Fuzzy Logic. Thank-you very much.

Just one question. This piece of code:

for ind = 1 : 2
fis_cart = setfisx(fis_cart, 'input', ind, 'range', bounds(ind, :));

"1:2" stands for inputs 1 and 2? I mean, in case we want to use your code to use more inputs, for instance 5, should we change that by "1:5"?

Best Regards, and thanks again for your work.


Contact us