Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Simulink.ModelDataLogs

Container for model's signal data logs

Description

    Note:   The ModelDataLogs format is supported for backwards compatibility. The ModelDataLogs format will be removed in a future release. For an existing model that uses the ModelDataLogs format, you should migrate the model to use Dataset format. For details, see Migrate from ModelDataLogs to Dataset Format.

    For new models, use the Dataset logging format, which stores logged data in Simulink.SimulationData.Dataset objects.

If you set Configuration Parameters > Data Import/Export > Signal logging format to ModelDataLogs, Simulink® software creates instances of the Simulink.ModelDataLogs 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:

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.

Was this topic helpful?