Simulink モデルを MATLAB ファイルやコマンドラインから起動し、実行するにはどうすればよいですか?
38 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 25 Oct 2013
Réponse apportée : MathWorks Support Team
le 25 Oct 2013
Simulink モデルを MATLAB ファイルやコマンドラインから起動し、実行する方法を教えてください。
Réponse acceptée
MathWorks Support Team
le 25 Oct 2013
以下に 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')
0 commentaires
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!