Main Content

coder.descriptor.DataInterface class

Package: coder.descriptor

Return information about different types of data interfaces


The coder.descriptor.DataInterface object describes various properties for a specified data interface in the generated code. The different types of data interfaces are:

  • Root-level inports and outports: An interface between the model and external models or systems, for exchanging data.

  • Parameters: Local and global parameters that describe the data for the block, lookup table, and the associated breakpoint set data.

  • Data Stores: A repository to store global and shared data that can be written and read.

  • Internal data: Internal data structures including DWork vectors, block I/O, and zero-crossings.

If your model has a Stateflow chart that uses machine-parented data, the code generator generates a DWork structure in the generated code. When you use the getDataInterfaces method, you cannot access these structures as InternalData.


dataInterface = getDataInterfaces(codeDescObj, dataInterfaceName) creates a coder.descriptor.DataInterface object. The codeDescObj object is the coder.codedescriptor.CodeDescriptor object created for the model by using the getCodeDescriptor function.

Input Arguments

expand all

Name of the specified data interface.

Example: 'Inports'

Data Types: string


expand all

The data type associated with the data such as integer, double, matrix, and its properties.

The Simulink identifier (SID) is a unique number within the model that Simulink assigns to the block.

The name of the associated graphical entity.

The variant conditions in the model that interact with the data interface.

The description of how the data in the generated code is implemented. This property describes characteristics such as data type and size. In addition, it describes how the data is accessed or declared in the code. The property describes if the data is declared as a variable or structure member.

The rate at which data is accessed in a run-time environment.

Specified physical units as attributes on signals at the boundaries of model components.

The range of valid values for the block output signals.


A bitfield data structure is generated if you select these configuration parameters:

  • Pack Boolean data into bitfields

  • Use bitset for storing state configuration

  • Use bitset for storing Boolean data

If the coder.descriptor.DataInterface represents a bitfield data structure, the Implementation property of the coder.descriptor.DataInterface object is empty.


collapse all

  1. Build the model.

  2. Create a coder.codedescriptor.CodeDescriptor object for the required model.

    codeDescObj = coder.getCodeDescriptor('rtwdemo_comments')
  3. Return a list of all data interface types in the generated code.

    dataInterfaceTypes = getDataInterfaceTypes(codeDescObj)
        {'Inports'         }
        {'Outports'        }
        {'Parameters'      }
        {'InternalData'    }
  4. Return properties of a specified data interface in the generated code.

    dataInterface = getDataInterfaces(codeDescObj, 'Inports')

    dataInterface is an array of coder.descriptor.DataInterface objects. Obtain the details of the first Inport block of the model by accessing the first location in the array.

    The first coder.descriptor.DataInterface object with properties is returned.
                  Type: [1×1 coder.descriptor.types.Double]
                   SID: 'rtwdemo_comments:1'
         GraphicalName: 'In1'
           VariantInfo: [0×0 coder.descriptor.VariantInfo]
        Implementation: [1×1 coder.descriptor.StructExpression]
                Timing: [1×1 coder.descriptor.TimingInterface]

Introduced in R2018a