Simulink.SimulationData.Dataset
Access logged simulation data or group simulation input data
Description
A Simulink.SimulationData.Dataset object groups related data.
Logged simulation results are often grouped in Dataset objects. You can
also use a Dataset object to group simulation input data when you load
initial states and when you load external input data using Inport blocks or the Signal
Editor block.
A Dataset object created by logging simulation data contains one or
more elements. Each element contains data for one logged signal, output, data store, or
state. Each element is an object, and the type of the object depends on the data it contains.
Signals and outputs —
Simulink.SimulationData.SignalobjectStates and final states —
Simulink.SimulationData.StateobjectData stores —
Simulink.SimulationData.DataStoreMemoryobject
When you create a Dataset object that groups simulation input data,
each element contains data for a signal, bus, or array of buses. You can add data in any
format supported by the loading method you use.
| Type of Input | Data Formats |
|---|---|
Scalar, vector, or multidimensional signal |
|
Bus |
|
Array of buses |
|
Function-call signal |
|
Creation
Logging simulation data often creates a
Simulink.SimulationData.Dataset object, including when you:
Log data using signal logging.
Log outputs, states, or final states using the
Datasetformat.Log data stores.
Log data to the workspace or a MAT file using the Record block.
Log data in
Datasetformat using a Scope block.Log data using a Floating Scope or Scope Viewer.
To group external input data for a model in a Dataset object, you can:
Create an empty
Datasetobject and add the input data using theaddElementfunction.Use the
createInputDatasetto create aDatasetobject that contains an element for each root-level Inport block or In Bus Element block in a model. Then, specify the data for each element.Use the Signal Editor to interactively create and edit
Datasetobjects that contain simulation input data. For details, see Create and Edit Signal Data.
You can also create a Dataset object by converting data that uses
another format to use the Dataset format. Having all data in
a common format can facilitate postprocessing. For details, see Convert timeseries Object to Dataset Object.
Syntax
Description
creates an empty, unnamed ds = Simulink.SimulationData.DatasetDataset object to which you can add
elements. Use this syntax to manually create a Dataset object
that contains external input data to load using Inport or
In Bus Element blocks.
creates an unnamed ds = Simulink.SimulationData.Dataset(dataToConvert)Dataset object that contains one or more
elements that contain the data dataToConvert. Use this syntax
to convert data that uses another format to use the
Dataset format. For details, see Convert timeseries Object to Dataset Object.
The conversion process only converts data for one input at a time. To convert
data for multiple variables, convert each variable one at a time, then use the
concat function to combine the resulting
Dataset objects.
creates a ds = Simulink.SimulationData.Dataset(dataToConvert,"DatasetName",dsName)Dataset object with the name specified by
dsName that contains one or more elements that contain
the data dataToConvert. Use this syntax to convert data that
uses another format to use the Dataset format. For
details, see Convert timeseries Object to Dataset Object.
Input Arguments
Output Arguments
Properties
Object Functions
addElement | Add element to end of Simulink.SimulationData.Dataset
object |
concat | Concatenate Simulink.SimulationData.Dataset object to another
Dataset object |
exportToPreviousRelease | Save a Dataset object to a MAT file you can open in any
release |
extractTimetable | Extract data from Simulink.SimulationData.Dataset or
Simulink.SimulationData.Signal objects into timetables |
find | Get element or collection of elements from
Simulink.SimulationData.Dataset object |
get | Get element or collection of elements from
Simulink.SimulationData.Dataset object |
getElementNames | Return names of all elements in Simulink.SimulationData.Dataset
object |
numElements | Get number of elements in Simulink.SimulationData.Dataset
object |
plot | Plot data in Simulation Data Inspector |
removeElement | Remove element from Simulink.SimulationData.Dataset
object |
setElement | Change Simulink.SimulationData.Dataset object element stored at
specified index |
Examples
Tips
You can use curly braces (
{}) to access, add, or modify an element in aDatasetobject by index.To access, add, or modify an element of a
Datasetobject by name, use thegetElement,addElement, andsetElementfunctions.When you group simulation inputs using
Datasetobjects, you can use the Signal Editor or the Signal Editor block to easily change whichDatasetobject provides input for the simulation.When you load external input data from a
Datasetobject using root-level Inport blocks, you can use the Root Inport Mapper to map each element in theDatasetobject to an Inport block by block name, block path, signal name, or port order. You can also write your own function to map the data. For more information, see Map Root Inport Signal Data.When you save data in a
Datasetobject to a MAT file, consider saving to a Version 7.3 MAT file if the contents of theDatasetobject are too large to fit in memory. You can create aSimulink.SimulationData.DatasetRefthat references aDatasetobject in a MAT file without loading the data into memory for data processing or for loading big data. For more information, see Load Big Data for Simulations.To save a
Datasetobject to a MAT file that you can open in an earlier release, use theexportToPreviousReleasefunction instead of thesavefunction.You can write your own reader to import data from a file into a
Datasetobject in the base workspace, the model workspace, or the Signal Editor using theSimulink.io.FileTypeclass. For more information, see Create Custom File Type for Import.
Version History
Introduced in R2011aSee Also
Objects
Simulink.SimulationOutput|Simulink.SimulationData.Signal|timeseries|timetable|Simulink.SimulationData.DatasetRef


