How can I run a SimMechanics simulation from a matlab script file/ workspace?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a script file which currently uses "From Workspace" / "To workspace" blocks as inputs / outputs for a simMechanics model. This works fine. However I wish to loop through many simulations of the model in my script, so that I can take the output of the model on a first run, do something with that output in my script file and then update the input of the model and run it again, and so on.
How would I do this? Any help would be appreciated!
댓글 수: 1
Walter Roberson
2012년 11월 5일
Please use better tags for this question; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
채택된 답변
Pouya Jamali
2012년 10월 27일
I think you can use sim command to run your simulink block diagram from your script m-file ... sim('block diagram name') stay in touch just if your problem persists more ...
댓글 수: 2
Pouya Jamali
2012년 11월 27일
An other way to do that is to use following commands:
set_param('modename','SimulationCommand','start') set_param('modename','SimulationCommand','pause') set_param('modename','SimulationCommand','continue') set_param('modename','SimulationCommand','stop')
and a Pause block on your model. the advantage of this method is to avoid compiling and initialization of the simulation in each iteration. It saves time.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!