Integrations (PTC products, 3rd party products and code) > 3rd party product integrations (CM, DOORS, Rose, Simulink and XML) > Integration for MATLAB Simulink > Mapping information > Class to Simulink mapping (Integration for MATLAB Simulink)
  
Class to Simulink mapping (Integration for MATLAB Simulink)
A Class in Modeler maps to a Simulink model and its Simulink block diagram:
You can create a Simulink model and its block diagram from a Modeler Class.
You can create a Modeler Class from a Simulink model and its block diagram.
After a Modeler Class is synchronized with a Simulink model and its block diagram, you can update the Simulink model from its associated Modeler Class, and update the Modeler Class from its associated Simulink model.
The way you model your Classes for exporting to Simulink depends on which Simulink Mapping you select on the Target Selection page of Integration for MATLAB Simulink. If you use the Simulink ERT Code Mapping, the way you model the Class is also affected by whether the Simulink Real-time Workshop is set up to use the Default Code Interface or Custom Code Interface.
The following Simulink Mappings are provided:
Simulink Basic Code Mapping
Use for generic mapping of Modeler items to Simulink objects.
Simulink ERT Code Mapping
Use when the Simulink Real-time Workshop is set up to use the ERT system target file for code generation.
Simulink GRT Code Mapping
Use when the Simulink Real-time Workshop is set up to use the GRT system target file for code generation.
Simulink Basic Code mapping
When exporting a Class to a Simulink model using the Simulink Basic Code Mapping, you use standard UML modeling of a Class.
The Class and its Attributes, Operations and Operation Parameters are exported as follows:
A Class is exported as a Simulink model and its block diagram.
An Attribute is exported as a DataStoreMemory.
An Operation is exported as a SubSystem.
An Operation Parameter is exported as an inport, outport or both, depending on the Parameter's Mechanism:
If the Parameter Mechanism is set to In, the Parameter is exported as an inport.
If the Parameter Mechanism is set to Out, the Parameter is exported as an outport.
If the Parameter Mechanism is set to In and Out, the Parameter is exported as an inport and as an outport.
Simulink ERT Code Mapping (Default Code Interface)
When exporting a Class to a Simulink model using the Simulink ERT Code Mapping with the Simulink Real-time Workshop set up to use the Default Code Interface, you model Simulink inputs and outputs through Attributes that are scoped to appropriately named child Classes of the Class you are exporting.
The Class and its Attributes are exported as follows:
A Class is exported as a Simulink model and its block diagram.
An Attribute is exported as an inport or outport:
If the Attribute is owned by the <Simulink model name>_U class, it is exported as an inport.
If the Attribute is owned by the <Simulink model name>_Y class, it is exported as an outport.
To work with the generated code, you may create four Operations for the Class named <Simulink model name>_initialize, <Simulink model name>_output, <Simulink model name>_update and <Simulink model name>_terminate.
* 
If a Simulink model has Real-time Workshop set up to use the Default Code Interface and you use Integration for MATLAB Simulink to import that Simulink model using the Simulink ERT Code Mapping, Integration for MATLAB Simulink will create the preceding Operations in the Modeler model.
Simulink ERT Code Mapping (Custom Code Interface)
When exporting a Class to a Simulink model using the Simulink ERT Code Mapping with the Simulink Real-time Workshop set up to use the Custom Code Interface, you model Simulink inputs and outputs through Operation Parameters.
The Class and its Operation and Operation Parameters are exported as follows:
A Class is exported as a Simulink model and its block diagram.
An Operation is exported as a function.
* 
You can have only one Operation.
An Operation Parameter is exported as an inport, output or both, depending on the Parameter's Mechanism:
If the Parameter Mechanism is set to In, the Parameter is exported as an inport.
If the Parameter Mechanism is set to Out, the Parameter is exported as an outport.
If the Parameter Mechanism is set to In and Out, the Parameter is exported as an inport and as an outport.
Simulink GRT Code Mapping
When exporting a Class to a Simulink model using the Simulink GRT Code Mapping, you model Simulink inputs and outputs through Attributes that are scoped to appropriately named child Classes of the Class you are exporting.
The Class and its Attributes are exported as follows:
A Class is exported as a Simulink model and its block diagram.
An Attribute is exported as an inport or outport:
If the Attribute is owned by the <Simulink model name>_U class, it is exported as an inport.
If the Attribute is owned by the <Simulink model name>_Y class, it is exported as an outport.