Main Content

Export FIS and Simulation Data from Fuzzy Logic Designer

Once you design your FIS using Fuzzy Logic Designer, you can export the active and stored designs to:

  • The MATLAB® workspace

  • FIS files (*.fis)

You can also export control-surface and rule-inference 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.

App toolstrip showing the Export Fuzzy Inference System to Workspace selection in the Export drop-down menu on the far right side of the toolstrip.

The Export Fuzzy Inference System to Workspace dialog box lists the active FIS design along with any stored designs.

Export Fuzzy Inference Systems to Workspace dialog box listing FIS designs to export. The table contains three columns: Export on the left with check boxes for selecting designs, Fuzzy Inference System in the middle with the design names, and Export As on the right with default variable names that match the design names.

In the Export column, select one or more systems that you want to export.

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.

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

You can save your FIS between Fuzzy Logic Designer sessions using a FIS file. To do so, in Fuzzy Logic Designer, under Save, select the fuzzy inference system.

You can select the current active design or any of the stored designs.

App toolstrip showing the Save drop-down menu. The cursor is over the single FIS listed in the drop-down menu.

In the Save Fuzzy Inference System dialog box, specify a filename and location, and click Save.

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

In Fuzzy Logic Designer, select Export > Export Simulation Results to Workspace.

App toolstrip showing the Export Simulation Results to Workspace selection in the Export drop-down menu on the far right side of the toolstrip.

The Export Simulation Results to Workspace dialog box lists the simulation results that are available for export.

Export Simulation Results to Workspace dialog box listing simulation results to export. The table contains three columns: Export on the left with check boxes for selecting results, Simulation Results in the middle with the simulation entry names, and Export As on the right with default variable names that match the simulation entry names.

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

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 DataDescription
Control surface data points

Data points for the plot displayed in the Control Surface document, exported as a structure with the following fields.

  • X — Data values for first selected input

  • Y — Data values for second selected input

  • Z — Data values for selected output

The dimensions of X, Y, and Z match the Mesh Points selections in the Control Surface document.

This control surface data matches the data points generated by the gensurf function.

Rule inference data

Rule inference data, exported as a structure with the following fields.

  • inputs — Input values

  • numSamplePoints — Number of sample points in output fuzzy sets. To specify this value, on the Design tab, set the Number of Samples parameter.

  • outputs — Output values

  • fuzzifiedInputs — Fuzzified input values

  • ruleOutputs — Rule outputs calculated by applying the rule firing strengths to the output membership function using the FIS implication method

  • aggregatedOutputs — Aggregated output calculated by combining the rule outputs using the FIS aggregation method

  • rulefiringStrengths — Rule firing strengths calculated by applying the rule connection operator to the values of the fuzzified inputs

The dimensions of the fuzzifiedInputs, ruleOutputs, aggregatedOutputs, and rulefiringStrengths fields depend on the type of FIS you exported. For more information, see evalfis.

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.

See Also

Related Topics