Simulink モデルを MATLAB ファイルやコマンドラ​インから起動し、実行​するにはどうすればよ​いですか?

Simulink モデルを MATLAB ファイルやコマンドラインから起動し、実行する方法を教えてください。

 Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 25 de Oct. de 2013

1 voto

以下に MATLAB ファイルまたはコマンドラインから Simulink モデルを起動、実行するコマンドを紹介します。
- Simulinkモデルを起動
open_system('モデル名')
- Simulinkモデルを実行
sim('モデル名')
または
set_param('モデル名','SimulationCommand','start')
※注意
SIM 関数は、シミュレーション終了時間まで実行され、その間は他のコマンドを実行することはできません。シミュレーション時間が有限時間の場合に有効な関数です。
SET_PARAM 関数を用いる場合、シミュレーション実行の間も他のコマンドを実行することができます。シミュレーション時間が無限時間の場合に有効な関数です。例えば、シミュレーションを10秒間実行し自動的に停止させる場合は、次のようなスクリプトで実現することが可能です。
set_param('モデル名','SimulationCommand','start')
pause(10);
set_param('モデル名','SimulationCommand','stop')
なお、”モデルの更新”は下記になります。
set_param('モデル名', 'SimulationCommand', 'update')

Más respuestas (0)

Categorías

Más información sobre Simulink 入門 en Centro de ayuda y File Exchange.

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!