| Contents | Index |
Simulink software creates instances of this class to contain signal logs that it creates while simulating a model (see Signal Logging). In particular, Simulink software creates an instance of this class for a top model and for each model referenced by the top model that contains signals to be logged. Simulink software assigns the ModelDataLogs object for the top 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:
Container for the data logs of a model
Container for the data logs of a subsystem
Container for the data logs of Scope signal viewers
Data log for any signal except a mux or bus signal
Data log for a mux or bus signal
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
Note If a name contains spaces, the ModelDataLogs objects specifies its name as ('name') where name is the actual name, e.g., ('Brake Subsystem'). See Handling Spaces and Newlines in Logged Names for more information. |
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.Data;
or
>> logsout.unpack('all');
>> data = clk.Data;
You can use a custom logging name or signal name when logging a signal. If you use the signal name, and that name occupies more than one line, include an sprintf('\n') between the lines of the signal name when accessing the logged data. For example, to access the signal in the following model:

Use the following syntax:
logsout.(['scope' sprintf('\n') '(delayed out)'])See Handling Spaces and Newlines in Logged Names for more information.
Importing and Exporting Simulation Data, Simulink.SubsysDataLogs, Simulink.ScopeDataLogs, Simulink.Timeseries, Simulink.TsArray, who, whos, unpack

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |