Skip to Main Content Skip to Search
Product Documentation

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

Syntax

convertedDataset = sourceModelDataLogsObject.convertToDataset(convertedDatasetName)

Description

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.

Limitations

Source of Simulink.ModelDataLogs Logged DataConversion Limitation

Referenced model

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

If the model has changed, or the model's ancestors have changed, after Simulink logged the data, the conversion may 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 activeas 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

sourceModelDataLogsObject

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

convertedDatasetName

Name of the dataset that the conversion process creates.

Output Arguments

convertedDataset

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

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

Example

Log signal data, simulate the model, and then convert the logged dataset to the Simulink.SimulationData.Dataset format.

  1. Open the vdp model by typing:

    vdp
  2. Right-click the x1 signal and select the Signal Properties menu item.

  3. Select the Log signal data property.

  4. Repeat steps 2 and 3 for the x2 signal.

  5. Simulate the model.

    Note that the vdp model has the Configuration Parameters > Data Import/Export > Signal logging parameter selected, and the signal logging object name set to logsout. Also, the Signal Logging Format parameter is set to ModelDataLogs.

  6. At the MATLAB command line, type:

    logsout
    logsout =
     
    Simulink.ModelDataLogs (vdp):
      Name                   Elements  Simulink Class
    
      x1                        1      Timeseries
      x2                        1      Timeseries
  7. Convert the logged dataset to use the Simulink.SimulationDataset format:

    dataset = logsout.convertToDataset('vdp_dataset')
    
    dataset = 
      Simulink.SimulationData.Dataset
      Package: Simulink.SimulationData
    
      Characteristics:
                  Name: 'vdp_dataset'
        Total Elements: 2
    
      Elements:
        1: 'x1'
        2: 'x2'
    
      Use getElement to access elements by index, name or block path.
    
      Methods, Superclasses

See Also

Simulink.ModelDataLogs | Simulink.SimulationData.Dataset | Simulink.SimulationData.updateDatasetFormatLogging

How To

  


Related Products & Applications

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