Real-Time Windows Target    

Entering Scope Parameters

Data is saved to the MATLAB workspace through a Simulink Scope block. Scope block parameters need to be set for data to be saved.

After you create a Simulink model and add a Scope block, you can enter the scope parameters for signal logging to the MATLAB workspace. This procedure uses the Simulink model rtwin_model.mdl as an example and assumes you have already loaded that model.

  1. In the Simulink window, double-click the Scope block.
  1. A Scope window opens.

  1. On the toolbar, click the Parameters button.

  1. A Scope parameters dialog box opens.

  1. Click the Data history tab.
  2. Do one of the following:
  1. Note The Limit data points to last check box is related to the Duration value in the External Signal and Triggering dialog box. The smaller of either value limits the number of sample points saved to the MATLAB workspace. When using the Real-Time Windows Target, we recommend that you use the Duration value to set the number of sample points you save.

    To set the Duration value, see Entering Signal and Triggering Properties.

  1. Select the Save data to workspace check box. In the Variable name text box, enter the name of a MATLAB variable. The default name is ScopeData.
  2. From the Format list, choose either Structure with time, Structure, or Array (compatible with V2.0-2.2). For example, to save the sample times and signal values at those times, choose Structure with time.
  1. Your Data history pane will look similar to the figure shown below.

  1. Do one of the following:
  1. Note When you modify anything in the Scope parameters dialog box, you must click the Apply or OK button for the changes to take effect, and you must rebuild your real-time application before connecting and starting it. If you do not rebuild, an error dialog box will open. If you do not click Apply, your executable will run, but it will use the old settings.

    The reason why you need to rebuild is because the model checksum includes settings from the Scope block used for signal logging. If the model checksum does not match the checksum in the generated code, the real-time application cannot run. Always rebuild your real-time application after changing Scope parameters.


  Signal Logging to the MATLAB Workspace Entering Signal and Triggering Properties