A root-level Inport, Enable, Trigger, and From Workspace block
can import data specified by a MATLAB®
timeseries object residing in a workspace.
Note: This documentation about importing MATLAB timeseries data includes examples of root Inport blocks. Unless specifically noted otherwise, the examples are applicable to root-level Enable, Trigger, and From Workspace blocks.
When you create a MATLAB
to import data to Simulink®, the time dimension depends on the
dimension and the type of signal data.
|Signal Data Dimension or Type||Time Dimension Alignment||Example of timeseries Constructor|
Scalar or a 1D vector
Constructor for a scalar signal. Time is aligned with the first dimension.
t = (0:10)'; ts = timeseries(sin(t), t);
2D (including row and column vectors) or greater
Constructor for a matrix signal. Time is aligned with the last dimension.
t = 0; ts = timeseries([1 2; 3 4], t);
2D row vector, and there is only one time step
t = 0; ts = timeseries([1 2], t, 'InterpretSingleRowDataAs3D', true);
To use a MATLAB
timeseries object for
a root Inport block in a model that has multiple root Inport blocks,
convert all of the other root Inport block data that uses
timeseries objects or to a structure
You can use the
to convert a
Simulink.Timeseries object to a MATLAB
For example, if
sim_ts is a
then the following line converts
sim_ts to a MATLAB
ts = sim_ts.convertToMATLABTimeseries;