www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/FromFileFromFileBlockLoadingTimeseriesDataExample.m
%% From File Block Loading Timeseries Data % Create a MATLAB(R) |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,:)) %% % 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.