User`s guide
3 Working with Real-Time Workshop
3-30
Tutorial 4: A First Look at Generated Code
In this tutorial, you examine code generated from a simple model to observe
the effects of some of the many code optimization features available in
Real-Time Workshop.
Note You can view the code generated from this example using the
MATLAB editor. You can also view the code in the MATLAB Help browser if
you enable the
Create HTML report option before generating code. See the
following section, “HTML Code Generation Reports” on page 3-37, for an
introduction to using the HTML report feature.
The source model,
example.mdl, is shown below.
Setting Up the Model
First, create the model from Simulink library blocks, and set up basic
Simulink and Real-Time Workshop parameters as follows:
1 Create a directory, example_codegen, and make it your working directory:
!mkdir example_codegen
cd example_codegen
2 Create a new model and save it as example.mdl.
3 Add Sine Wave, Gain, and Out1 blocks to your model and connect them as
shown in the preceding diagram. Label the signals as shown.
4 From the Simulation menu, choose Configuration Parameters. The
Configuration Parameters dialog opens.