| Simulink® | ![]() |
Simulink software creates instances of this class to contain signal logs that it creates while simulating a model (see Logging Signals). In particular, Simulink software creates an instance of this class for a top-level model and for each model referenced by the top-level model that contains signals to be logged. Simulink software assigns the ModelDataLogs object for the top-level model to a variable in the MATLAB workspace. The name of the variable is the name specified in the Signal logging name field on the Data Import/Export pane of the model's Configuration Parameters dialog box. The default value is logsout.
A ModelDataLogs object has a variable number of properties. The first property, named Name, specifies the name of the model whose signal data the object contains or, if the model is a referenced model, the name of the Model block that references the model. The remaining properties reference objects that contain signal data logged during simulation of the model. The objects may be instances of any of the following types of objects:
Log for a signal in this model.
Container for the logs of the elements of a root-level composite signal (e.g., a Mux or Bus Creator signal) in this model.
Container for the logs of a model referenced by this model.
Container for the signal logs of a subsystem of this model.
Container for data displayed on Scope signal viewers (see Visualizing Simulation Results in Using Simulink®).
The names of the properties identify the data being logged as follows:
For signal data logs, the name of the signal
For a subsystem or model log container, the name of the subsystem or model, respectively
For a scope viewer data log, the name specified on the viewer's parameter dialog box
Consider, for example, the following model.

As indicated by the testpoint icons, this model specifies that Simulink software should log the signals named step and scope in the model's root system and the signal named clk in the subsystem named Delayed Out. After simulation of this model, the MATLAB workspace contains the following variable:
>> logsout
logsout =
Simulink.ModelDataLogs (siglgex):
Name Elements Simulink Class
scope 2 TsArray
step 1 Timeseries
('Delayed Out') 2 SubsysDataLogs
The logsout variable contains the signal data logged during the simulation. You can use fully qualified object names or the Simulink unpack command to access the signal data stored in logsout. For example, to access the amplitudes of the clk signal in the Delayed Out subsystem, enter
>> data = logsout.('Delayed Out').clk;
or
>> logsout.unpack('all');
>> data = clk;
You can use a custom logging name or signal name when logging a signal. If you choose to use the signal name, and that signal name is a multiline one, seen in the following:

include an sprintf('\n') between the two lines of the signal name when accessing the logged data. For example,
logsout.(['scope' sprintf('\n') '(delayed out)'])Simulink.Timeseries, Simulink.TsArray, Simulink.SubsysDataLogs, Simulink.ScopeDataLogs, unpack
![]() | Simulink.ModelAdvisor | Simulink.ModelWorkspace | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |