Startup from top Simulink model

8 ビュー (過去 30 日間)
Henok Mentamo
Henok Mentamo 2014 年 6 月 5 日
回答済み: Henok Mentamo 2014 年 6 月 9 日
Hello!
I would like to know if there is a setting somewhere in the Simulink options or a work around for the situation that whenever I start Simulink and open the a project/ model, I would like it to start from the top model instead of some random referenced model or a sub-system that I had been working on the last time before I logged off the computer or closed the Matlab program.

採用された回答

Henok Mentamo
Henok Mentamo 2014 年 6 月 9 日
Thanks Sebastian!

その他の回答 (1 件)

Sebastian Castro
Sebastian Castro 2014 年 6 月 5 日
編集済み: Sebastian Castro 2014 年 6 月 5 日
First of all, the model opens up wherever your view was (both location and zoom level) when you last saved it. A good best practice is to navigate up to the top before saving your model.
That aside, there is an "automagical" workaround. There are 2 commands you need to know for this, and you can use the documentation to look up more about this.
  • open_system : Essentially, the command-line equivalent to open a Simulink model or subsystem.
  • bdroot : This command gives you the top-level system name for the currently active model window.
So, if you are anywhere within a model, you can navigate to its top level by saying:
>> open_system(bdroot)
You can then put this in the PostLoadFcn callback of the model, as shown in this screenshot:

カテゴリ

Help Center および File ExchangeNaming Conventions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by