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.
Note
If you entered the scope parameters for running a simulation, you may want to look over this procedure because the Scope parameters dialog box is related to the External Signal and Triggering dialog box.
|
- In the Simulink window, double-click the Scope block.
- A Scope window opens.
- On the toolbar, click the Parameters button.
- A Scope parameters dialog box opens.
- Click the Data history tab.
- Do one of the following:
- If you are running a simulation, you can select the Limit data points to last check box, and enter the number of sample points to save.
- If you are running an execution, do not select the Limit data points to last check box.
- 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.
- 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
.
- 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
.
- Your Data history pane will look similar to the figure shown below.
- Do one of the following:
- Click Apply to apply the changes to your model and leave the dialog box open.
- Click OK to apply the changes to your model and close the Scope parameters dialog box.
- 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 |  |