Simulation status is stopped but I cannot start new simulation from script because Matlab assumes it is still running
8 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a problem with running a Simulink model from script many times in a row. While running a simulation I check in a timer update function with get_param(SimName, 'SimulationStatus'), if the model's status is 'stopped' or not, and if it is 'stopped' I save the output data, change some variables, and try to run the simulation again with set_param(SimName, 'SimulationCommand', 'start'). This mostly works fine but sometimes (it seems quite stochastic, so I really do not know what could cause it) I catch the following error: 'Cannot start a new command line simulation while a simulation has started for the same model.'
Could anyone please tell me what the source of the problem is and if there is any solution for it. Thank you in advance.
0 个评论
回答(1 个)
Fangjun Jiang
2023-7-13
Might it be too fast to re-start the simulation? There could be some post-simulation processing going on.
Anyway, in the M-script, add a pause(3) statement before re-starting the simulation to see if it improves.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!