set_param( bdroot ,'SimulationCommand' , 'continue') doesn't work after pause

9 ビュー (過去 30 日間)
wojciech
wojciech 2017 年 12 月 2 日
コメント済み: Ben Krämer 2020 年 10 月 30 日
I use assertion block, where on the block activation three commands are consecutively called:
set_param( bdroot ,'SimulationCommand' , 'pause') ;
some_custom_script();
set_param( bdroot ,'SimulationCommand' , 'continue');
The last one, which should resume simulation doesn't have any effect, simulation stays paused. At the same time I can resume it manually by clicking start button in Simulink model window.
The problem doesn't occur if I initiate simulation with sim('my_model') from Matlab command line. This way however, workspace doesn't update with partial results like xout when simulation pauses, which is the reason why I try to pause simulation in the first place.
I would be grateful for any hint why my simulation can't be resumed or suggesting alternative way for obtaining simulation results for already solved timesteps before reaching end of its time span.
  2 件のコメント
MK
MK 2019 年 2 月 6 日
Do you found a solution for your question?
Ben Krämer
Ben Krämer 2020 年 10 月 30 日
To whoever stumbles across this problem:
This answer worked for me.

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

回答 (1 件)

Dong-Hyun Cho
Dong-Hyun Cho 2020 年 4 月 14 日
I also had similar problem, and I just used the update command with triger subsystem such as
function TestFlag = TestCode(u)
% set_param(bdroot,'SimulationCommand','pause');
assignin('base','cfs_Epoch',u);
set_param(bdroot,'SimulationCommand','update');
% set_param(bdroot,'SimulationCommand','continue');
TestFlag = 1;
end
I also don't know the why the 'continue' commend was not working, but the simulink is automatically pause -> update -> continue by suing just update commend.
Please, try it. ^^

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by