Trying to find if configurable subsystem present in given model or not by using find_system() API, but it is not giving any value even the model contain ConfigurableSubsystem.

2 ビュー (過去 30 日間)
My model contains Configurable Subsytem in it and I can see the Configurable Subsystem block present in the model through UI. When I tried to find all the confugurable blocks through m-script it is not giving an empty output.
I used the following ways to find and all gave me an empty output.
  • find_system('modelName', 'BlockType', 'ConfigurableSubsystem')
  • find_system('modelName', 'BlockType', 'ConfigurableSubsystem', 'FollowLinks', 'on', 'LookUnderMasks', 'all')
Even tried to find the type of the block which is showing as Configurable Subsystem in UI by getting the path with the following code
blkpath = 'EMachine/E-Machine/IsConst';
type = get_param(blkpath, 'BlockType');
  • The above code is giving me the type of block is Subsystem, but in UI it is ConfigurableSubsystem.
How to get all the blockpaths of all Configurable Subsystem and convert them to Variant Subsystems through scripts as I'm not able to find the Configurable Subsystem blocks?
Tried using upgradeAdvisor on the model to convertand it is working but it is increasing the build time alot and it is not feasible right now.

採用された回答

Nithin
Nithin 2025 年 4 月 24 日
Hi @Veera,
To find all the "Configurable Subsystem" blocks, use the following command:
find_system(bdroot, 'Regexp', 'on',...
'LookUnderMasks', 'on', 'FollowLinks', 'on',...
'MatchFilter', @Simulink.match.allVariants, 'TemplateBlock', '.')
This will return a list of all "Configurable Subsystem" blocks present in the model.
To convert all the "Configurable Subsystem" blocks to "Variant Subsystem" block use the following command:
Simulink.VariantUtils.convertToVariantSubsystem('path to the block')
According to MathWorks documentation, the "Configurable Subsystem" block will be removed starting with MATLAB R2024b, so it is recommended to avoid using them in new designs.
For more information about conversion of "Configurable Subsystem" to "Variant Subsystem", refer to the following documentation: https://www.mathworks.com/help/releases/R2024a/simulink/ug/convert-configurable-subsystem-to-variant-subsystem.html#mw_78d4d928-53df-47ce-8579-b4df1decdc0e
  3 件のコメント
Nithin
Nithin 2025 年 4 月 24 日
Use the following command instead:
get_param(blocks{1},'TemplateBlock');
It is mentioned in the link provided above.
Veera
Veera 2025 年 4 月 24 日
Thank you somuch for the answers you provided and now I'm able to convert to Variant subsystems present in my model.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by