Convert logging data from Simulink.ModelDataLogs format to Simulink.SimulationData.Dataset format


convertedDataset = sourceModelDataLogsObject.convertToDataset(convertedDatasetName)


    Note:   The ModelDataLogs class is supported for backwards compatibility. Starting in R2016a, you cannot log data in the ModelDataLogs format. Signal logging uses the Dataset format. In R2016a or later, when you open a model from an earlier release that had used ModelDataLogs format, the model simulated in use Dataset format.

    You can convert signal logging data from ModelDataLogs to Dataset format. Converting to Dataset format makes it easier to post-process with other logged data (for example, logged states), which can also use Dataset format. For more information, see Convert Logged Data to Dataset Format.

    If you have legacy code that uses the ModelDataLogs API, you can encounter situations that require updates to your code or model. See Migrate Scripts That Use ModelDataLogs API.

convertedDataset = sourceModelDataLogsObject.convertToDataset(convertedDatasetName) converts the sourceModelDataLogsObject to a Simulink.SimulationData.Dataset object. The name of the converted object is based on convertedDatasetName.

The resulting Simulink.SimulationData.Dataset object is a flat list. This list has one element for each Simulink.Timeseries or Simulink.TsArray object in the Simulink.ModelDataLogs object.


Source of Simulink.ModelDataLogs Logged DataConversion Limitation

Referenced model

Loads all ancestors of the referenced model not previously loaded. If any ancestor model does not appear on the MATLAB® path, the conversion fails.

If the model has changed, or the model ancestors have changed, after Simulink® logged the data, the conversion can fail. For example, adding, deleting, or renaming a block after logging can cause conversion failure.

Variant model or subsystem

The current active variant must be the same one that was active when Simulink logged the data. Otherwise, the conversion fails.

Frame signal

The conversion fails.

Mux block

The conversion produces a different Simulink.SimulationData.Dataset object as the dataset than Simulink creates when you simulate the model using the Dataset format for the logged data.

Stateflow® chart

Not supported.

Input Arguments


A Simulink.ModelDataLogs object that you want to convert to a Simulink.SimulationData.Dataset object.


Name of the dataset that the conversion process creates.

Output Arguments


The Simulink.SimulationDataset object that the Simulink.ModelDataLogs.convertToDataset function creates.

For details about the converted dataset, see Simulink.SimulationData.Dataset.


In releases before R2016a, you could log signals using ModelDataLogs format. If you have a MAT-file with signal logging data that uses the ModelDataLogs format, here is how you can convert that data to Dataset format. This example assumes that the model that generated the logging data had the Configuration Parameters > Data Import/Export > Signal logging name set to logsout.

  1. Load the MAT-file.

  2. Convert logsout to a dataset called myModel_dataset. (The elements information will be different for your data.)

    dataset = logsout.convertToDataset('myModel_Dataset')
    dataset = 
      Package: Simulink.SimulationData
                  Name: 'myModel_Dataset'
        Total Elements: 2
        1: 'x1'
        2: 'x2'
      -Use get or getElement to access elements by index or name.
      -Use addElement or setElement to add or modify elements.
      Methods, Superclasses

Introduced in R2011a

Was this topic helpful?