フィルターのクリア

how to add goto from block and connected to the ports of a existed simulink system programmtically

24 ビュー (過去 30 日間)
hello,i have a simulink subsystem with some port defined inside, for example it has two inports and two outports,now i want add from block and connected to the inport,add goto block and connect to the outport,both goto block and from block should be named same as the connected port,how to do this?

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 7 月 1 日 12:40
  1. find_system(), 'blocktype','inport' to find the Inport and Outport blocks.
  2. get_param() to get the Inport and Outport block names
  3. add_block() to add Goto and From blocks
  4. add_line() to connect
  2 件のコメント
wenchao zhang
wenchao zhang 2024 年 7 月 1 日 13:28
ok,but position may be also need consider,they need keep same horizon
Fangjun Jiang
Fangjun Jiang 2024 年 7 月 1 日 16:33
Yes. The position can be specified when add_block(). Or you can use set_param() separately.
The port position of the subsystem block that contains the Inport and Outport blocks can be used to determine the positions of the Goto and From blocks.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by