| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
| On this page… |
|---|
Configuring Input and Output Ports |
Create a model in Simulink. See Creating a Model in the Simulink documentation.
Right-click a signal line. Select Signal Properties. A Signal Properties dialog box opens. See Signal Properties Dialog Box for more information.
Specify a signal name.
On the same Signal Properties dialog box, select the Real-Time Workshop tab and specify a storage class for the signals. (Examples use models with signals that are Exported Global).
In your model,
Double-click an Inport or Outport block. A block parameters dialog box opens.
Select the Signal Attributes tab.
Specify the Port dimensions and Data type.
Double-click a block.
In the block parameters dialog box, select the Main tab.
Specify the Initial conditions and Sample time. See Working with Sample Times.
Select the State Attributes pane. Specify the state name. See Block State Storage and Interfacing Considerations
You can also use the Data Object Wizard for creating data objects. A part of this process initializes states. See Creating Simulink Data Objects with Data Object Wizard.
Open the Configuration Parameter dialog box by selecting Simulation > Configuration parameters. You can also use the keyboard shortcut Ctrl + E.
Open the Solver pane and select
Solver type: Fixed-Step
Solver: Discrete (no continuous states)
Open the Optimization pane, and select the Inline parameters parameter.
Open the Real-Time Workshop pane, and specify ert.tlc as the System Target File.
Clear Generate makefile.
Select Generate code only.
Enable the HTML report generation by opening the Real-Time Workshop > Report pane and selecting Generate HTML Report, Launch report automatically, and Code-to-block highlighting. Enabling the HTML report generation is optional.
Click Apply and then OK to exit.
If you have a Stateflow chart in your model, initialize the inputs, outputs, local variables, and parameters of the Stateflow chart for code generation.
In your model, double-click a Stateflow. If you are not familiar with Stateflow, see the Stateflow Getting Started Guide.
Select Tools > Explore or Ctrl+R to launch the Chart Explorer.
On the Chart Explorer, select Add > Data or enter Ctrl+D. From the drop-down list, select an input, output, local variable, parameter, or function call. You see a Data dialog box.
In the Data dialog box, enter the Name of the data.
Specify the Scope.
Specify the Type. Choose a built-in data type or inherit the data type.
Click Apply and close the dialog box.
![]() | About Modeling Patterns | Control Flow | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |