Getting top level of System Composer Simulink model

3 ビュー (過去 30 日間)
Paul
Paul 2022 年 11 月 15 日
回答済み: Alvaro 2022 年 12 月 28 日
I want to display the progress of a System Composer simulation and I need to get the stop time of the simulation.
I am trying to run a system composer model which contains models/behaviours from a script. The code of my script is as follows:
cb.mdl = "ArchIOD1";
cb.simInput = Simulink.SimulationInput(cb.mdl);
cb.simInput = setModelParameter(cb.simInput, "StopTime", "500")
cb.out = sim(cb.simInput);
This works but I can't seem to get the value of StopTime that I just set. When I call this:
str2double(get_param(bdroot,'StopTime'));
The result is the default value of 10 of a model, instead of 500.
bdroot is not giving the expected value. The value should be "ArchIOD1" and instead its giving me the name of the referenced model within ArchIOD1 which is calling it.
How can I can I get the real top level of this model from inside a referenced model?

回答 (1 件)

Alvaro
Alvaro 2022 年 12 月 28 日
You can change the stop time of the model by running
set_param('ArchIOD1', 'StopTime', '500')

カテゴリ

Help Center および File ExchangeSystem Composer についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by