getFISCodeGenerationData

Create homogeneous fuzzy inference system structure

To generate code for evaluating a fuzzy inference system using MATLAB® Coder™, you must convert your fuzzy inference system object into a homogeneous structure using getFISCodeGenerationData.

Syntax

fisOut = getFISCodeGenerationData(fisIn)

Description

example

fisOut = getFISCodeGenerationData(fisIn) converts a fuzzy inference system fisIn into a homogeneous structure fisOut. fisIn can be a FIS object or the name of a .fis file.

Examples

collapse all

Create a fuzzy inference system. For this example, load a fuzzy system from a file.

fisObject = readfis('tipper');

Convert the resulting mamfis object into a homogeneous structure.

fisStructure = getFISCodeGenerationData(fisObject);

In this structure, if a field is a structure array, all the elements of that array are the same size. For example, consider the elements of input variable array fisStructure.input.

fisStructure.input(1)
ans = struct with fields:
              name: 'service'
    origNameLength: 7
             range: [0 10]
                mf: [1x3 struct]
         origNumMF: 3

fisStructure.input(2)
ans = struct with fields:
              name: 'food   '
    origNameLength: 4
             range: [0 10]
                mf: [1x3 struct]
         origNumMF: 2

The name fields are character vectors of the same length. Also, even though the second input variable has only two membership functions, the mf fields both contain three membership function structures. The original number of membership functions for a given input variable is stored in the origNumMF field.

Load the fuzzy inference system saved in the file tipper.fis into a homogeneous structure.

fis = getFISCodeGenerationData('tipper.fis');

Input Arguments

collapse all

Input fuzzy inference system, specified as one of the following:

  • mamfis or sugfis object. getFISCodeGenerationData supports fuzzy inference system objects for simulation only.

  • String or character vector specifying a .fis file in the current working folder or on the MATLAB path. getFISCodeGenerationData supports fuzzy inference system file names for both simulation and code generation.

When getFISCodeGenerationData loads a fuzzy system that uses custom functions, it writes additional files to the current folder to support code generation for the custom functions.

Output Arguments

collapse all

Output fuzzy inference system, returned as a homogeneous structure. In the homogeneous structure, if a field is a structure array, all the elements of that array are the same size. For example, in the input variable array fisOut.input:

  • Names of all the variables are character vectors of the same length.

  • Lengths of the membership function arrays for all variables are the same.

For any character vectors or structure arrays that are padded to increase their lengths, the original lengths of these elements are saved within the structure.

The fisOut structure is different than the structure created using convertToStruct.

Extended Capabilities

Introduced in R2018b