Real-Time Windows Target |
 |
Entering Scope Parameters
Data is saved to a disk drive by first saving the data 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 a disk drive. 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 and the Data Archiving 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 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
.
- Note The Scope parameters dialog box is related to the Data Archiving dialog box. In the Scope parameters dialog box, you must select the Save data to workspace check box to be able to save data to a disk drive for two reasons:
- The data is first transferred from the data buffer to the MATLAB workspace before being written to a MAT-file.
- The Variable name entered in the Scope parameters dialog box is the same variable in the MATLAB workspace and the variable in the MAT-file.
If you do not select the Save data to workspace check box, the MAT-files for data logging will be created, but they will be empty.
- 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. Also, you must rebuild your real-time application before connecting and stating a real-time application.
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.
| Signal Logging to a Disk Drive | | Entering Signal and Triggering Properties |  |