Main Content

Simulink.SubsysDataLogs

(Not recommended) Access data for signals logged inside subsystems

    The ability to log and load data using the ModelDataLogs format has been removed. Use another supported format, such as Dataset, instead. For more information, see Compatibility Considerations.

    Description

    The Simulink.SubsysDataLogs object contains the data for each signal, mux, and bus logged inside a subsystem.

    Creation

    Prior to R2016a, you could configure a model to log data using the ModelDataLogs format. Simulating a model with the Signal logging format parameter set to ModelDataLogs created a Simulink.ModelDataLogs object that contained the data for all logged signals. You could specify the name for the ModelDataLogs object using the Signal logging name parameter.

    A ModelDataLogs object contains a Simulink.SubsysDataLogs object for each subsystem in the model that contains logged data.

    Properties

    expand all

    Logged Data Properties

    The Simulink.SubsysDataLogs object contains properties with the signal data logged inside the subsystem the object represents. The number, type, and names of the properties that contain logged data depend on subsystem contents and the logging configuration.

    Property Name SourceLogged Data SourceValue
    Model nameTop model or model referenceSimulink.ModelDataLogs
    Subsystem nameSubsystemSimulink.SubsysDataLogs
    Signal nameSignalSimulink.Timeseries
    Mux or virtual bus nameMux or virtual busSimulink.TSArray
    Bus objectNonvirtual busSimulink.TSArray

    Subsystem Properties

    Name of subsystem represented by object, specified as a character vector.

    Object Functions

    unpack(Not recommended) Extract signal data from ModelDataLogs, SubsysDataLogs, or TSArray object into workspace variables
    who(Not recommended) List names of objects inside ModelDataLogs, SubsysDataLogs, or TSArray object
    whos(Not recommended) List name and type of objects inside ModelDataLogs, SubsysDataLogs, or TSArray object

    Examples

    collapse all

    Suppose you have data logged in a release prior to R2016a for a model that marked signals for logging inside the subsystem Subsystem. The Simulink.ModelDataLogs object logsout has the property Subsystem that contains the logged data for signals marked for logging inside the subsystem. You can view the contents of the Simulink.SubsysDataLogs object by using a dot to access the Subsystem property. In this example, the signal a and the bus m were marked for logging inside the subsystem.

    logsout.Subsystem
    Simulink.SubsysDataLogs (Subsystem):
      Name                   elements  Simulink Class
    
      a                         1      Timeseries
      m                         2      TsArray
    

    You can access the data for the signal or bus by using the unpack function to assign the value of each property to a variable in the base workspace with the same name.

    unpack(logsout,'all');
    data = a.Data;
    

    Version History

    Introduced before R2006a

    expand all

    R2022b: Loading data saved in the ModelDataLogs format no longer supported

    Starting in R2022b, you can no longer load data stored in the ModelDataLogs format, including data stored in Simulink.Timeseries, Simulink.TSArray, and Simulink.SubsysDataLogs objects.

    You can convert data stored in the ModelDataLogs format to the Dataset format. For more information, see Convert Data to Dataset Format.