Main Content


Save fuzzy inference system to file


You can save a fuzzy inference system (FIS) in a FIS file (*.fis) using the writeFIS function. To load the saved file, use the readfis function.


Do not manually edit the contents of a FIS file. Doing so can produce unexpected results when loading the file using a function, such as readfis and getCodeGenerationData, or an app, such as Fuzzy Logic Designer.


writeFIS(fis,fileName) saves the fuzzy inference system fis to the current working folder using file name fileName.

writeFIS(fis) opens a dialog box for saving a FIS. In this dialog box, specify the name and location of the FIS file.

writeFIS(fis,fileName,"dialog") opens a dialog box for saving a FIS, setting the name of the file in the dialog box to fileName. In the dialog box, specify the location for the file.


collapse all

Create a fuzzy inference system and add an input variable with membership functions.

fis = mamfis("Name","tipper");
fis = addInput(fis,[0 10],"Name","service");
fis = addMF(fis,"service","gaussmf",[1.5 0],"Name","poor");
fis = addMF(fis,"service","gaussmf",[1.5 5],"Name","good");
fis = addMF(fis,"service","gaussmf",[1.5 10],"Name","excellent");

Save the fuzzy system in the current working folder.


Input Arguments

collapse all

Fuzzy inference system, specified as one of the following:

  • mamfis object — Mamdani fuzzy inference system

  • sugfis object — Sugeno fuzzy inference system

  • mamfistype2 object — Type-2 Mamdani fuzzy inference system (since R2019b)

  • sugfistype2 object — Type-2 Sugeno fuzzy inference system (since R2019b)

File name, specified as a string or character vector. If you do not specify the .fis extension in the file name, writeFIS adds the extension.


writeFIS changes the name of the saved FIS to match the specified file name.

Version History

Introduced in R2018b

expand all