Replace a subsystem A with subsytem B on different models

7 ビュー (過去 30 日間)
Kinane
Kinane 2012 年 7 月 30 日
Hi Im trying to replace a subsystem "oldSub" in "model1" with another subsystem "newSub" in "model2". i used this syntaxis, no error occures but no change in "model1" either !!
replace_block('model1','Name','oldSub','model2/newSub')
i updated "model1" using: set_param('model1','SimulationCommand','Update'), that didnt help ...
thx in advance
kinane

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 7 月 30 日
Does 'oldSub' exist in the top-level of the model or inside a subsystem? For example, does the following command return any value:
find_system('model1','Name','oldSub','SearchDepth',1)
Also, you need to make sure that both 'model1' and 'model2' are loaded when you run the command(s). You can use the load_system command to load (ie. open in the background) the models.
  7 件のコメント
Kaustubha Govind
Kaustubha Govind 2012 年 8 月 3 日
Just a word of caution - is "tout" the variable logged by the model? I don't know if there is a guarantee that this variable is written to at the end of every time-step. There is a possibility that the value is maintained in an internal buffer and updated to the workspace once in a while.
Kinane
Kinane 2012 年 8 月 9 日
編集済み: Kinane 2012 年 8 月 10 日
yes it is,and yes, in my case i read "tout" when i pause simulation, still it does get written after each time-step. :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by