This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create MATLAB Timeseries Data for Root Inports

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.

Specify Time Dimension

When you create a MATLAB timeseries object to import data to Simulink®, the time dimension depends on the dimension and the type of signal data.

Signal Data Dimension or TypeTime Dimension AlignmentExample 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


'InterpretSingleRowDataAs3D', true
For example:
t = 0;
ts = timeseries([1 2], t, 'InterpretSingleRowDataAs3D', true);

Models with Multiple Root Inport Blocks

To use a MATLAB timeseries object for a root Inport block in a model that has multiple root Inport blocks, convert all the other root Inport block data that uses Simulink.TsArray or Simulink.Timeseries objects to one of these formats:

  • MATLAB timeseries objects

  • A structure of MATLAB timeseries objects

You can use the Simulink.Timeseries.convertToMATLABTimeseries method to convert a Simulink.Timeseries object to a MATLAB timeseries object. For example, if sim_ts is a Simulink.Timeseries object, then the following line converts sim_ts to a MATLAB timeseries object:

ts = sim_ts.convertToMATLABTimeseries;

See Also


Related Examples

More About

Was this topic helpful?