MATLAB Answers

How can I convert a .fis file (fuzzy) into a .m file?

65 views (last 30 days)
Pedro on 30 Apr 2013
Commented: Asif Shah on 20 Mar 2020
I need to convert the file so that I can take the .m file and convert into C code to program a dsp whith a fuzzy controller.

  1 Comment

Iman Ansari
Iman Ansari on 30 Apr 2013
It's a text file, you can open it with matlab editor or notepad. It's for defining your fuzzy system (Inputs, Outputs, Membership Functions, rules, ...), nothing more.

Sign in to comment.

Answers (2)

Shahar on 29 Aug 2013
Edited: Shahar on 29 Aug 2013
You can convert the fis struct to .m code with gencode function from filexchange, at
If your code looks something like
myg = readfis('FisFile.fis');
then use
strx = gencode(myg);
fid = fopen('c:\scriptFis.m','w');
fprintf(fid, '%s\n', strx{:});
and then you can run scriptFis from command line to load variable myg.


alfred on 4 Jul 2017
strx = gencode(myg)
It line produce an error then doesn't work.
Error: Undefined function 'gencode' for input arguments of type 'struct'.
And then matlab recommend to use:
strx = genmcode(myg);
but doesn't work either...
Error: Error using genmcode Too many output arguments.
Walter Roberson
Walter Roberson on 4 Jul 2017
Did you install the noted File Exchange Contribution?

Sign in to comment.

Hagar Mahmoud
Hagar Mahmoud on 3 Dec 2019
I'm trying the same thing, however the posted example on file exchange for converting .fig file not .fiS files.
I have added the files and run, but I got the follwoing error meesge in scriptFis.m file
warning('myg: No code generated for object of class mamfis.')
Any help ??

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!