Store data logged by Scope signal viewer
Note: The Simulink.ScopeDataLogs class is used in conjunction with the ModelDataLogs logging data format. The ModelDataLogs format is supported for backwards compatibility. The ModelDataLogs format will be removed in a future release.
For new models, use the Dataset logging format. If you use the Dataset format for signal logging, then Simulink® does not log the signals configured to be logged in the Signal Viewer. Explicitly mark the signal for signal logging by using the Signal Properties dialog box. To access the Signal Properties dialog box, right-click a signal and from the context menu, select Properties.
Simulink software creates instances of this class to log data displayed on Scope viewers (see Visualize Results). In particular, if you have enabled data logging for a model, Simulink software creates an instance of this class for each scope viewer enabled for logging in the model and assigns it to a property of the model's Simulink.ModelDataLogs object. The instance created for each viewer has a Name property whose value is the name specified on the History pane of the viewer's parameter dialog box (see Scope for more information). The instance also has an axes property for each of the scope's axes labeled Axes1, Axes2, etc. The value of each axes property is itself a Simulink.ScopeDataLogs object that contains Simulink.Timeseries objects, one for each signal displayed on the axes. The time series objects contain the signal data displayed on the axes.
This model displays signals G1 and G2 on a Scope viewer that has only one axis.
The model enables data logging as a whole under the default variable name logsout.
To log signals attached the Scope viewer, right click a signal, select Properties, and then select the Log signal data check box.
After simulation of the model, the MATLAB® workspace contains a Simulink.ModelDataLogs object named logsout containing a Simulink.ScopeDataLogs object that in turn contains a Simulink.ScopeDataLogs object that contains Simulink.Timeseries objects that contain the times series data for signals out1 and out 2.
You can use Simulink data object dot notation to access the data, e.g.,
>> logsout logsout = Simulink.ModelDataLogs (scopedatalogs_ex): Name Elements Simulink Class SL_G11 1 Timeseries SL_G21 1 Timeseries