matlab.io.datastore.SimulationDatastore
Datastore for inputs and outputs of Simulink models
Description
A matlab.io.datastore.SimulationDatastore object enables a
Simulink® model to interact with big data. When individual input signals are too
large to fit into memory, store data to persistent storage in a MAT file and refer to
the data through a SimulationDatastore object. The data from the
SimulationDatastore object loads into the simulation incrementally
in chunks that fit into memory. See Work with Big Data for Simulations.
A SimulationDatastore object refers to big simulation data for one
signal stored in a MAT file. If the MAT file stores simulation data for a bus, a
SimulationDatastore object refers to the data for one leaf element
in the bus.
Note
You cannot create a SimulationDatastore representation for
Dataset elements that contain array data.
To analyze the datastore data, you can use the functions and properties of the
SimulationDatastore object as well as functions
such as the tall function. For more information,
see Getting Started with Datastore.
Creation
To create a SimulationDatastore object, first create a Simulink.SimulationData.DatasetRef object. The DatasetRef
object references a Simulink.SimulationData.Dataset object,
which is stored in a MAT file, that contains your element of interest. Then, use curly
braces or the getAsDatastore function to get a
SimulationDatastore representation of that element from the
referenced Dataset object.
When the Dataset element of interest is a timeseries
or timetable object, the getAsDatastore function
returns a SimulationDatastore object. Otherwise, the
SimulationDatastore object exists in the
Values property of the returned
Simulink.SimulationData.Signal,
Simulink.SimulationData.State, or similar object.
For example, suppose you configure a model to log signal data to persistent storage by
selecting the Log Dataset data to file configuration
parameter in the Configuration Parameters > Data
Import/Export pane and simulate that model. All logged simulation data
that uses the Dataset format is logged to a MAT file with the default
name out. In the MAT file, signal logging data is saved in a
Simulink.SimulationData.Dataset object with the default variable
name logsout. Create a DatasetRef object that
references the signal logging data in the MAT file. Then, use curly braces to get a
SimulationDatastore object for the first element in the referenced
Dataset object. The SimulationDatastore object
exists in the Values property of the returned
Simulink.SimulationData.Signal object.
sigLogRef = Simulink.SimulationData.DatasetRef("out.mat","logsout"); firstSig = sigLogRef{1}
firstSig =
Simulink.SimulationData.Signal
Package: Simulink.SimulationData
Properties:
Name: 'x1'
PropagatedName: ''
BlockPath: [1x1 Simulink.SimulationData.BlockPath]
PortType: 'outport'
PortIndex: 1
Values: [1×1 matlab.io.datastore.SimulationDatastore]Properties
Object Functions
hasdata | Determine whether data is available to read |
isPartitionable | Determine whether datastore is partitionable |
isShuffleable | Determine whether datastore is shuffleable |
reset | Reset datastore to initial position |
readall | Read all data in datastore |
read | Read chunk of data in datastore |
preview | Return subset of data from datastore |
progress | Return percentage of data read from datastore |
Examples
Limitations
SimulationDatastoredoes not support using a parallel pool with Parallel Computing Toolbox™ installed. To analyze data using tall arrays or run MapReduce algorithms, set the global execution environment to be the local MATLAB® session usingmapreducer.For information about controlling parallel resources, see Run mapreduce on a Parallel Pool (Parallel Computing Toolbox).mapreducer(0)
You cannot use a MATLAB tall variable as simulation input data.
Version History
Introduced in R2017a


