How to reorganize blocks programmatically based on another block.

7 ビュー (過去 30 日間)
Hesam 2018 年 7 月 4 日
編集済み: TAB 2018 年 7 月 6 日
Hi, I am trying to organize a model programmatically. Basically I want to reposition all the Inports/outports of a subsystem with respect to the inputs and outputs of a subsystem block. Here is an example of what I am trying to accomplish. Does anyone now of a simple way to do so?
Thank you very much in advance

回答 (2 件)

Mark McBroom
Mark McBroom 2018 年 7 月 5 日
You will need to write MATLAB code that uses find_system() to locate the subsystem, inports and outports, and then get_param(gcbh,'Position')/set_param(gcbh,'Position', ...) to obtain and change their location on the canvas.

TAB 2018 年 7 月 6 日
編集済み: TAB 2018 年 7 月 6 日
Check this submission on file exchange:
You can modify it to suite your need.


Find more on Subsystems in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by