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.

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.

 Accepted Answer

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 Comments

Hi @Nithin,
Thanks for the solution.
With the above solution I'm able to find the Configurable subsystems in my model but when I tried to convert to variant subsystem using
  • Simulink.VariantUtils.convertToVariantSubsystem('path to the block');
but getting the following error
  • Error: Programmatic conversion of Configurable Subsystem block 'IsConst' to Variant Subsystem is not supported as it is a reference of 'Lib/Config'. Please convert the referenced block 'Lib/Config' first.
The model I'm using has only one configurable subsystem block and it not independent block. It is a referenced block from a user defined library. So, I tried to fetch the link status of that block and also Reference block path by using
blocks = find_system(bdroot, 'Regexp', 'on', 'LookUnderMasks', 'on', 'FollowLinks', 'on', 'MatchFilter', Simulink.match.allVariants, 'TemplateBlock', '.');
fprintf('Number of Configurable blocks: %d\n', length(blocks)); //getting 1 printed in command prompt
fprintf('Path of Configurable Subsystems: %s\n', blocks{1});
status = get_param(blocks{1}, 'LinkStatus');
fprintf('LinkStatus: %s\n', status); //getting LinkStatus: none printed on cmd prompt
LinkedPath = get_param(blocks{1}, 'ReferenceBlock');
fprintf('LinkedPath: %s\n', LinkedPath); //getting ' '(empty string) printed on cmd prompt
Can you help me how can I find the reference block path so that I can convert to Variant Subsystem by using
Simulink.VariantUtils.convertToVariantSubsystem('path to the block') ;
Use the following command instead:
get_param(blocks{1},'TemplateBlock');
It is mentioned in the link provided above.
Thank you somuch for the answers you provided and now I'm able to convert to Variant subsystems present in my model.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2024b

Asked:

on 9 Apr 2025

Commented:

on 24 Apr 2025

Community Treasure Hunt

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

Start Hunting!