Real-Time Workshop User's Guide    

Part 1: Setting Up the Model

In this part of the tutorial, you create a simple model, ext_example, and a directory called ext_mode_example to store the model and the generated executable:

  1. Create the directory from the MATLAB command line by typing
  2. Make ext_mode_example your working directory.
  3. Create a model in Simulink with a Sine Wave block for the input signal, two Gain blocks in parallel, and two Scope blocks. The model is shown below. Label the Gain and Scope blocks as shown.

  4. Define and assign two variables A and B in the MATLAB workspace as follows.
  5. Open Gain block A and sets its Gain parameter to the variable A as shown below.

  1. Similarly, open Gain block B and sets its Gain parameter to the variable B.

    When the target program is built and connected to Simulink in external mode, new gain values can be downloaded to the executing target program by assigning new values to workspace variables A and B, or by editing the values in the block parameter dialog boxes.

  1. Verify correct operation of the model. Open the Scope blocks and run the model. Given that A=2 and B=3, the output should look like this.

  2. From the File menu, choose Save As. Save the model as ext_example.mdl.

 Tutorial: Getting Started with External Mode Using GRT Part 2: Building the Target Executable