How to incrementally save output data from long Simulink simulation?

Hey everyone,
I'm using Simulink to compute the response of a linear, parameter varying system (LPV system). Within the simulation 24h data shall be generated with a sample frequency of 800 Hz. I'd like to save the output incrementally every 10 minutes.
My question is: How can I perform these blockwise savings?
Thanks
Stefan

 採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 5 月 30 日

0 投票

You can specify the start and stop time of the simulation. The key point is to save the final state of the last simulation and use it as the initial state of the next simulation. Below is an example, you can change the loop number and insert the save command inside the loop to save your data.
vdp;
tStart='0';
tStop='10';
out=sim('vdp','StartTime',tStart,'StopTime',tStop,...
'SaveFormat','Structure',...
'SaveFinalState','On','FinalStateName','xFinal');
for k=1:1
tStart=tStop;
tStop=num2str(10+k*10);
x0=out.xFinal;
out=sim('vdp','StartTime',tStart,'StopTime',tStop,...
'SaveFormat','Structure',...
'LoadInitialState','On','InitialState','x0',...
'SaveFinalState','On','FinalStateName','xFinal');
end

1 件のコメント

Stefan
Stefan 2018 年 6 月 1 日
Hey,
this is also the solution I finally implemented successfully. Many thanks.
Stefan

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2018a

質問済み:

2018 年 5 月 30 日

コメント済み:

2018 年 6 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by