Main Content

Simulink.TSArray

(Not recommended) Access logged data for mux or bus

    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.TSArray object contains the data for a logged mux or bus.

    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 and object contains a Simulink.TSArray object for each mux or bus logged in the model the object represents. A SubsysDataLogs object contains a Simulink.TSArray object for each mux or bus logged in the subsystem the object represents.

    Properties

    expand all

    Logged Data Properties

    The Simulink.TSArray object contains properties with the data logged for each element of the bus or mux the object represents. The number, type, and names of the properties that contain logged data depend on the structure of the mux or bus the object represents.

    Property Name SourceLogged Data SourceValue
    Signal nameMux or bus elementSimulink.Timeseries object
    Nested mux or virtual bus nameNested mux or virtual busSimulink.TSArray object
    Bus objectNested nonvirtual busSimulink.TSArray object

    Metadata Properties

    Signal logging name, 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 using ModelDataLogs format. The Simulink.ModelDataLogs object logsout contains a Simulink.TSArray object for the bus b2. You can view the contents of the Simulink.TSArray object by using a dot to access the b2 property of the Simulink.ModelDataLogs object. The bus b2 contains the signal x1 and the nested bus b1.

    logsout.b2
    Simulink.TsArray (untitled/Bus Creator1):
      Name                   elements   Simulink Class
    
      x1                        1       Timeseries
      b1                        2       TsArray
    
    

    To access the logged signal data for the signal x1, you can use the unpack function to assign the contents of the ModelDataLogs property to a variable in the workspace with the same name. Then, you can use a dot to inspect the property values for the Simulink.Timeseries object that contains the signal data.

    unpack(logsout,'all');
    data = x1.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.