Export FIS and Simulation Data from Fuzzy Logic Designer
Once you design or tune your FIS using Fuzzy Logic Designer, you can export the active and stored designs to:
The MATLAB® workspace
FIS files (
*.fis
)MAT files (
*.mat
)
You can also export simulation results for your FIS designs.
Export FIS to Workspace
To export a FIS design to the MATLAB workspace, in Fuzzy Logic Designer, select Export > Export Fuzzy Inference System to Workspace.
The Export Fuzzy Inference System to Workspace dialog box lists the active FIS design along with any stored designs.
In the Export column, select one or more systems that you want to export.
The active FIS design is selected by default. (since R2024a)
In the Export As column, specify names for the workspace variables.
Click Export.
The app saves the FIS to the MATLAB workspace as one of the following types of objects.
mamfis
— Type-1 Mamdani FISsugfis
— Type-1 Sugeno FISmamfistype2
— Type-2 Mamdani FISsugfistype2
— Type-2 Sugeno FIS
Once you export your FIS, you can:
Perform additional simulations at the command line using the
evalfis
function.Simulate your system in Simulink® using the Fuzzy Logic Controller block.
Generate code for your system. For more information, see Deployment.
Save FIS to File
To save your FIS to a file, in Fuzzy Logic Designer, under Save, select the fuzzy inference system.
You can select the current active design or any of the stored designs.
In the Save Fuzzy Inference System dialog box, specify a filename and location, and click Save.
When saving a FIS design, you can use a FIS file or a MAT file.
When saving a FIS tree design, you must use a MAT file.
Export Simulation Data
After evaluating your FIS using Fuzzy Logic Designer, you can export the following simulation results to the MATLAB workspace for the active and stored designs.
Control surface data points
Rule inference data (individual FIS only)
Error distribution data (since R2023a)
System validation data (since R2023a)
FIS tree data flow results (FIS tree only) (since R2024a)
In Fuzzy Logic Designer, select Export > Export Simulation Results to Workspace.
The Export Simulation Results to Workspace dialog box lists the simulation results that are available for export. To export simulation results, you must first view the corresponding simulation document in the app.
The following figure shows the Export Simulation Results to Workspace dialog box for a single FIS object.
The Simulation Results column indicates the FIS designs and the
type of simulation data using one of the following entries, where
<design>
indicates the FIS design.
<design>_ControlSurfaceData
— Control surface data points<design>_RuleInferenceData
— Rule inference data<design>_ErrorDistributionData
— Error distribution dataSystemValidationData
— System validation data for all selected designs<design>_FISTreeDataFlowData
— FIS tree data flow results
In the Export column, select one or more simulation results that you want to export.
In the Export As column, specify names for the workspace variables.
Click Export.
The app saves each selected simulation result to the MATLAB workspace as a structure, as defined in the following table.
Simulation Data | Description |
---|---|
Control surface data points | Data points for the most recent plot displayed in the Control Surface document for the active design, exported as a structure with the following fields.
The dimensions of This control
surface data matches the data points generated by the |
Rule inference data | Rule inference results for the active design, including intermediate computed values, exported as a structure with the following fields.
The dimensions of the |
Error distribution data (since R2023a) | Error distribution data for the active design, exported as a structure with the following fields, each containing a numeric array.
|
System validation data (since R2023a) | System validation data for all selected FIS designs, exported as a structure with the following fields.
A selected design is a design for which you select the Compare option in the Design Browser. |
FIS tree data flow results (since R2024a) | FIS tree data propagation for the active design using the most recent input values specified in the FIS Tree Plot document, exported as a structure with the following fields.
|
For the active FIS design, the exported simulation results correspond to the simulation settings, such as the input values in the Rule Inference document or the selected axes in the Control Surface document, currently defined in the app.
For a stored FIS design, the exported simulation results correspond to the simulation settings when the design was most recently active in the app. In other words, the exported results for a stored design may not use the simulation settings currently defined in the app.