Main Content

coder.descriptor.FunctionInterface class

Package: coder.descriptor

Return information about entry-point functions


The function interfaces are the entry-point functions in the generated code. The coder.descriptor.FunctionInterface object describes various properties for a specified function interface. The different types of function interfaces are:

  • Allocation: Contains memory allocation code based on the target of the model. See model_initialize.

  • Initialize: Contains initialization code for the model and is called once at the start of your application code. See model_initialize.

  • Output: Contains the output code for the blocks in the model. See model_step.

  • Update: Contains the update code for the blocks in the model. See model_step.

  • Terminate: Contains the termination code for the model and is called as part of a system shutdown. See model_terminate.


functionInterface = getFunctionInterfaces(codeDescObj, functionInterfaceName) creates a coder.descriptor.FunctionInterface object. codeDescObj is the coder.codedescriptor.CodeDescriptor object created for the model by using the getCodeDescriptor function.

Input Arguments

expand all

Name of the specified function interface

Example: 'Output'

Data Types: string


expand all

The description of the function prototype including function return value, name, arguments, header, and source files.

The data that the function returns as a return argument. When there is no data returned from the function, this field is empty.

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

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

The data passed as arguments to the function. When there is no data passed as an argument to the function, this field 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 function interface types in the generated code.

    functionInterfaceTypes = getFunctionInterfaceTypes(codeDescObj)
        {'Output'    }
  4. Return properties of a specified function interface in the generated code.

    functionInterface = getFunctionInterfaces(codeDescObj, 'Output')
            Prototype: [1×1 coder.descriptor.types.Prototype]
         ActualReturn: [0×0 coder.descriptor.DataInterface]
          VariantInfo: [0×0 coder.descriptor.VariantInfo]
               Timing: [1×1 coder.descriptor.TimingInterface]
           ActualArgs: [1x0 coder.descriptor.DataInterface List]
Introduced in R2018a