Main Content

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,:))

  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.


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.