This example shows how to select a target for a Simulink model, generate C code for real-time simulation, and view generated files.
1. Open the model.
2. Open the Configuration Parameters dialog box from the model editor by clicking Simulation > Configuration Parameters.
Alternately, type the following commands at the MATLAB command prompt
cs = getActiveConfigSet(model); openDialog(cs);
3. Select the Code Generation node.
4. In the Target Selection pane, click Browse to select a target.
You can generate code for a particular target environment or purpose. Some built-in targeting options are provided using system target files, which control the code generation process for a target.
5. Select the Generic Real-Time (GRT) target and click Apply.
Optionally, in the Code Generation Advisor pane set the Select objective field to Execution efficiency or Debugging. Then click Check model... to identify and systematically change parameters to meet your objectives.
6. In the Code Generation pane, click Build to generate code.
7. View the code generation report that appears.
The report includes links to model files such as rtwdemo_rtwintro.c and associated utility and header files.
The figure below contains a portion of rtwdemo_rtwintro.c
8. Close the model.