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


convertedDataset = sourceModelDataLogsObject.convertToDataset(convertedDatasetName)


    Note:   The ModelDataLogs format is supported for backward 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. 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.

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.


If you have signal logging data from a model that has Configuration Parameters > Data Import/Export > Signal logging format set to ModelDataLogs format, you should change the logging format to Dataset. However, 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 theConfiguration 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?