To Expand Subsystem by using model explorer

Hi,
is it possible any subsystem to expand by using model exploerer?
Thank you in advance
Mustafa

4 件のコメント

Fangjun Jiang
Fangjun Jiang 2021 年 1 月 22 日
??
Mustafa Uslu
Mustafa Uslu 2021 年 1 月 22 日
Hi Jiang,
I have a lot of subsystems eacht with an undersubsystem in my model and I would like to expand only the undersubsystems.
It is not to easy click each one individually and expand it.
Because of I would like to carry out with any efforts. For example by using model explorer.
Do you have some other idea?
Thanks.
Mustafa
Fangjun Jiang
Fangjun Jiang 2021 年 1 月 23 日
something like "Expand all" or "Collapse all"?
Mustafa Uslu
Mustafa Uslu 2021 年 1 月 23 日
I wouldn't like to expand the subsystem on the highest level of my model, but each sub-system on the highest level has a sub subsystem.
My goal is to expand all of these sub subsystems, in order to expand without clicking each subsystem individually.
many thanks.

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

 採用された回答

Sai Veeramachaneni
Sai Veeramachaneni 2021 年 1 月 25 日

1 投票

Hi,
Step-1: Get all the blocks and subsystems in the model using find_system(modelname,'Type','Block')
Step-2: Apply Simulink.BlockDiagram.expandSubsystem(blockname). This type of Subsystem expansion applies to the currently selected subsystem level. Simulink does not expand other subsystems in a nested subsystem hierarchy which is the functionality you are looking for.
Example:
blocks = find_system(model_name,'Type','Block');
for i = 1:numel(blocks)
try
Simulink.BlockDiagram.expandSubsystem(blocks{i})
catch
%This will catch when we try to expand anything apart from Subsystem.
continue
end
end
Hope it helps.

その他の回答 (1 件)

Mustafa Uslu
Mustafa Uslu 2021 年 1 月 27 日
編集済み: Mustafa Uslu 2021 年 1 月 27 日

0 投票

Hi Sai,
thank you for your solution.
If I try to write below code in Matlab Command window, then I get always this message:
E.g.:
Simulink.BlockDiagram.expandSubsystem('SubsystemExpansionModel/Subsystem')
Invalid Simulink object specifier
Note: subsystems are not masked, linked, or commented.
Thanks
Mustafa

3 件のコメント

Sai Veeramachaneni
Sai Veeramachaneni 2021 年 1 月 27 日
Hi,
Check that model is opened properly and 'Subsystem' is existed inside SubsystemExpansionModel.
If you try to open the subsystem which is already opened, you might get an error.
Mustafa Uslu
Mustafa Uslu 2021 年 1 月 27 日
Hi Sai,
thank you for your tip, it has worked.
I have an additional question to top script, what you did write.
I would like to below 'for loop' for certain paths in my model.
E.g.
for i=11:10:1141
target= find_system ('modelname/subsystemhighestlevel{i}/subsubsystem');
Simulink.BlockDiagram.expandSubsystem('target','CreateArea','Off');
end
Unfortunately it does not work.
Do you know how a path / directory can be counted up iteratively?
Thanks
Mustafa
Mustafa Uslu
Mustafa Uslu 2021 年 1 月 29 日
Hi Sai,
I have solved this issue with below code script based on your first suggestion.
By the way , it is possible to get child subsystem of subsystem on the highest level with 'SearchDepth'......
Thanks and BR
Mustafa
blocks=find_system('model_name','SearchDepth','2','Name','target_subsystem');
for i = 1:numel(blocks)
try
Simulink.BlockDiagram.expandSubsystem(blocks{i})
catch
%This will catch when we try to expand anything apart from Subsystem.
continue
end
end

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

カテゴリ

ヘルプ センター および File ExchangeSubsystems についてさらに検索

製品

リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by