This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

From File Block Loading Timeseries Data

Create a MATLAB® timeseries object with time and signal values. Save the timeseries object to a MAT-file and load into a model using a From File block.

Create an array with the time and signal data, specifying signal data for 10 time steps.

t = .1*(1:10);
d = .2*(1:10);
x = [t;d];

Create a MATLAB timeseries object.

ts = timeseries(x(2:end,:),x(1,:))
  timeseries

  Common Properties:
            Name: 'unnamed'
            Time: [10x1 double]
        TimeInfo: tsdata.timemetadata
            Data: [1x1x10 double]
        DataInfo: tsdata.datametadata

Save the timeseries object in a Version 7.3 MAT-file.

save('mySignals','ts','-v7.3')

Add a From File block and set the File name parameter of that block to mySignals.mat.

Simulate the model. The Scope block reflects the data loaded from the mySignals.mat file.