Simulink.SimulationData.Dataset class

Package: Simulink.SimulationData

Create Simulink.SimulationData.Dataset object


Simulink® creates Simulink.SimulationData.Dataset objects to store data elements when:

  • Performing signal logging, which use the Dataset format

  • Logging states or outputs, if you use the default format of Dataset.

  • Logging a data store

Using the Dataset format for state and output logging offers several advantages compared to Array, Structure, or Structure with time. For details, see Format for State Information Saved Without SimState.

Simulink.SimulationData.Dataset provides a getElement method for accessing individual elements in the data set. You can specify an element by index, name, or block path.


convertedDataset = Simulink.SimulationData.Dataset(loggedDataToConvert) converts the loggedDataToConvert to a Simulink.SimulationData.Dataset object. You can then use the Simulink.SimulationData.DataSet.concat method to combine elements of two Dataset objects.

constructedDataset = Simulink.SimulationData.Dataset(variableName,'DatasetName','dsname') constructs a Simulink.SimulationData.Dataset object, adds variable variableName, and names the data set dsname.

Input Arguments

expand all

Data element to convert to a data set, specified as a character vector. You can convert elements such as:

  • Array

  • Structure

  • Structure with time

  • MATLAB® time series

  • Structure of MATLAB time-series elements

  • ModelDataLogs

Variable to add to data set, specified as a character vector.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'DatasetName','dsname'

expand all

Data set name, specified as a character vector.

Output Arguments

expand all

Converted data set, returned as a Simulink.SimulationData.Dataset object.

Constructed data set, returned as a Simulink.SimulationData.Dataset object.


expand all

Name of the data set, specified as a character vector or logging variable (for example, logsout for signal logging). Specify a name when you want to distinguish easily one data set from another. For example, you could reset the name when comparing multiple simulations. This property is read/write.

ds = Simulink.SimulationData.Dataset
ds.Name = 'Dataset1'

Total number of elements in data set, specified as a double. This property is read only. To get this value, use the Simulink.SimulationData.DataSet.numElements method.


addElementAdd element to end of data set
concatConcatenate dataset to another dataset
findGet element or collection of elements from dataset
getGet element or collection of elements from dataset
getElementNamesReturn names of all elements in dataset
numElementsGet number of elements in data set
plotPlot dataset elements in Signal Preview window or Simulation Data Inspector
setElementChange element stored at specified index

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB documentation.


expand all

Convert data from two To Workspace blocks, convert to Dataset format, and concatenate them. myvdp is the vdp model with two To Workspace blocks with variables named simout and simout1. These blocks log data in time-series format.

mdl = 'myvdp';
ds = Simulink.SimulationData.Dataset(simout);
ds1 = Simulink.SimulationData.Dataset(simout1);
dsfinal = concat(ds,ds1)

Related Examples

Introduced in R2011a

Was this topic helpful?