Supress simulink from evaluating initialisation commands while editing

1 ビュー (過去 30 日間)
Matthias Oe
Matthias Oe 2018 年 8 月 30 日
コメント済み: Matthias Oe 2018 年 8 月 31 日
Hello Community,
I have a problem while editing my rather complex simulink model. I have some masked subsystems which read indexed parameters in their initialisation commands. In the mask I define the index with an edit field. Furthermore all parameters are definded in an initialisation script and the simulation is also started by a script where all variables are assigned directly to the model workspace with assignin.
The very annoying problem is, that if I change the index in the mask of the subsystem I get the error
Initialization commands cannot be evaluated.
Caused by:
Index exceeds array bounds.
When I start my initialisation script and set a debug point after the assignin command I can change the index variable without any errors.
Now I am wondering whether there is a way to supress simulink from evaluating my initialisation commands while I am editing my model and do this only on simulation start instead.

採用された回答

TAB
TAB 2018 年 8 月 31 日
You can check model simulation status on mask initialization to decide whether to run your command or not.
if ~strcmpi(get_param(bdroot(gcbh), 'SimulationStatus'), 'stopped')
...
...
end
Possible values of Simulation Status are:
{'stopped'} | 'updating' | 'initializing' | 'running' | 'paused' | 'terminating' | 'external'
  1 件のコメント
Matthias Oe
Matthias Oe 2018 年 8 月 31 日
Works out of the box. Thank you very much!

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

その他の回答 (0 件)

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by