open('sldemo_bounce');
mdl = bdroot;
set_param(mdl, 'SaveFinalState', 'on', 'FinalStateName',...
[mdl 'SimState'],'SaveCompleteFinalSimState', 'on')
[t1, Y1] = sim(mdl, [0 15]);
plot(t1,Y1,'b');
set_param(mdl, 'LoadInitialState', 'on', 'InitialState',...
[mdl 'SimState']);
[t2, Y2] = sim(mdl, [15 25]);
hold on; plot(t2,Y2,'r');
set_param(mdl, 'LoadInitialState', 'off');
1 Comment
Azzi Abdelmalek (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/45077-run-a-simulink-model-for-a-certain-amount-of-time-and-pause#comment_92684
Sign in to comment.