How can I run Simulink 'Build model' from the command line

조회 수: 13 (최근 30일)
Yunshen Huang
Yunshen Huang 2020년 1월 2일
편집: Yunshen Huang 2020년 1월 2일
Hi all,
I am now want to run the Simulink with Quanser hardware in matlab 2012b in external mode. Therefore I need to run 'build model' every time before connect to the hardware.
My Current work is to countineously run the Simulink until the result satisfies some critirions. Therefore, I prefer to run the simulink programmly. However I only found 'set_param' to connect, start the Simulink. However, there is no way for me to run the 'Build model' function purely by the cmd line.
The reason that I have to build first is that there is one 'From Workspace' block. For each time I run the Simulink, I have to update this variable. This caused original build model is different with the current variable-updated one, which raises an error says like the model is different, cannot connect. Therefore, there is another way to solve my issue is that update variables without changing the built model.
To sum up, my question is 1. how to run Simulink 'Build model' from the command line. or 2. how to update the 'from workspace' block's value without changing the originally built model.
Thanks for your help!

답변 (1개)

Jeremy
Jeremy 2020년 1월 2일
편집: Jeremy 2020년 1월 2일
I'm not sure if I'm understanding your use case completely, but I think you are looking for sim?
sim('modelname.slx');
If that doesn't help, then perhaps in.applyToModel?
  댓글 수: 1
Yunshen Huang
Yunshen Huang 2020년 1월 2일
편집: Yunshen Huang 2020년 1월 2일
Thanks for your reply. But 'sim' seems doesn't support the external mode. Once I use
sim('plt_get_traj.slx','SimulationMode','external')
it reports
Cannot perform command line simulation of 'plt_get_traj' in external mode
While I have to run it in external mode

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by