Main Content

Dataset signal format

Option to specify whether elements of Dataset object for logged data store values as timeseries or timetable objects

Model Configuration Pane: Data Import/Export

Description

Use this parameter to specify whether logged data is stored within elements of a Simulink.SimulationData.Dataset object as timeseries objects or as timetables.

The value you specify for this parameter affects the way state, time, and output data is logged only when the Format parameter value is Dataset.

This parameter does not effect data logged for variable-size signals or data logged using Scope blocks. Logged data for variable-size signals is always stored in a timetable that contains a cell array of signal values for each time step. Configure the format for logged Scope block data using the block parameters.

The table summarizes a comparison between the timeseries and timetable objects.

Characteristic or Operationtimeseriestimetable
Merge logged dataUse the extractTimetable function to extract data for multiple signals into one or more timetable objects that each contain data for one or more signals.Merge each timetable that contains a single column with data for one signal into a timetable that contains multiple columns, each with data for a different signal.
View object properties

The timeseries object separates time and data properties into two separate properties on the object, TimeInfo and DataInfo.

ts
 timeseries

  Common Properties:
            Name: ''
            Time: [1001x1 double]
        TimeInfo: [1x1 tsdata.timemetadata]
            Data: [1001x1 double]
        DataInfo: [1x1 tsdata.datametadata]
 

Query the properties of the timetable to view all properties and their values at once.

tt.Properties
ans =

  struct with fileds:

           Description: ''
              UserData: []
        DimensionNames: {'Time' 'Variables'}
  VariableDescriptions: {}
         VariableNames: ['temperature' 'WindSpeed' 'WindDirection']
         VariableUnits: {}
    VariableContinuity: ['continuous']
              RowTimes: [64x1 duration]
              
Access data values

Data values are stored in the Data property of the timeseries object. This command accesses the logged output values for the first output port in the model.

output1 = out.yout{1}.Values.Data;

Data values are stored in the Data property of the timetable. This command accesses the logged output values for the first output port in the model.

output1 = out.yout{1}.Values.Data;
Multidimensional data access

Time aligns with the last dimension of data logged for states, signals, data stores, and outputs that have two or more dimensions, including row vectors with dimensions 1-by-n. The length of the last dimension of the matrix in the Data property matches the number of samples logged in simulation.

Time aligns with the first dimension of data logged for scalar and wide states, signals, data stores, and outputs.

Time always aligns with the first dimension of data logged for states, signals, and outputs. For example, if you log data for a signal that has dimensions 3-by-2, each element in the Data property of the timetable has dimensions 1-by-3-by-2.
Units

Units for logged data are stored in the Units property of the timeseries object.

Logging stores units in the timeseries object as a Simulink.SimulationData.Unit object.

Loading signal data that uses units is supported for timeseries objects with units specified as a Simulink.SimulationData.Unit object.

Units for data values are not supported.

Time values must be a duration vector. Time values in logged data have units of seconds to match the unit of simulation time.

Identify element as continuous or discrete

The Interpolation property is linear for continuous signals, states, and outputs and zoh for discrete signals, states, and outputs.

The VariableContinuity property is continuous for continuous signals, states, and outputs and step for discrete signals, states, and outputs.

Check whether time data is evenly spaced

The TimeInfo property indicates whether the time data is uniform.

You can also use the isregular function to determine whether the time data is evenly spaced.

Use the isregular function to determine whether the time data is evenly spaced.
View signal nameSignal name stored on object.Signal name not stored on object.

Settings

timeseries (default) | timetable
timeseries

Save Dataset element values in timeseries objects.

timetable

Save Dataset element values in timetable objects.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
Efficiency

No recommendation

Safety precaution

No recommendation

Programmatic Use

Parameter: DatasetSignalFormat
Type: string | character vector
Values: 'timeseries' | 'timetable'
Default: 'timeseries'

Version History

Introduced in R2017b