Is there anyway to pause and start function with sim command? I writed in a loop "sim" command and it is working but video display is blinking cause of starting-stoping simulation again and again. That is working start-stop mechanism, i need start-pause mechanism =)
How to associate M-File and Simulink?
3 次查看(过去 30 天)
显示 更早的评论
I have to execute physic system with codes in progressing with time. I did that in an M-File(coordinates is working) but the other system which is connected with physic system is in Simulink. I couldn't associate M-File in progressing with time and Simulink. May i did that with sim command setting parameters?
My purpose is drawing an object with Simulink but object's coordinates is changing with time and this parameters calculating with M-File. How can i do that? Thank you for the answers now, sorry for bad english =/
回答(1 个)
Wayne King
2011-12-27
Hi Ercin, You can use the MATLAB function block.
3 个评论
Kaustubha Govind
2011-12-29
You can place the MATLAB Function block inside an Enabled Subsystem and control its execution using an enable signal.
The sim command only returns to MATLAB after the simulation is complete, so if you want to be able to pause simulation, you need to start simulation using set_param(bdroot,'SimulationCommand','start') so that control is immediately returned to MATLAB. You can then use the PAUSE command (say pause(5) if you want to run for 5secs) to let the model run for a short period, and then use set_param(bdroot,'SimulationCommand','pause') to pause simulation. Use set_param(bdroot,'SimulationCommand','stop') to stop simulation.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!