Set configuration parameter in Simulink

1 回表示 (過去 30 日間)
Alessandra Cuneo
Alessandra Cuneo 2015 年 10 月 5 日
コメント済み: Alessandra Cuneo 2015 年 10 月 5 日
Hi,
I have to run a simulink model from a script in Matlab. I'm using the sim command to run the model but I not find the right command to set the initial state. I am able to do it from the model (Simulation --> configuration parameters --> initial state) but I have some problem to do it from a script. Could anyone suggest me a solution?
Thanks

採用された回答

Sebastian Castro
Sebastian Castro 2015 年 10 月 5 日
For all configuration parameters in a model, you can right-click them and select "What's This?" This will bring up a small window which contains a table showing you the command-line way to use that particular parameter.
Following the above workflow, the parameters you care about are LoadInitialState and InitialState
You can do this either by using set_param before running the model or in the sim command itself.
>> set_param(bdroot,'LoadInitialState','on','InitialState','variableName');
>> simout = sim(bdroot,'StopTime','10');
>> simout = sim(bdroot,'StopTime','10','LoadInitialState','on','InitialState','variableName');
- Sebastian
  1 件のコメント
Alessandra Cuneo
Alessandra Cuneo 2015 年 10 月 5 日
Thank you so much...I implemented in the code and it works!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeManual Performance Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by