[Simulink] Subsystems are locked and the parameters cannot be changed.

7 ビュー (過去 30 日間)
takaka
takaka 2022 年 8 月 29 日
回答済み: Riya 2025 年 4 月 23 日
Hi,
I have a problem in Simulink model.
I put several same subsystems in one model (for example, named 'SS1' and 'SS2'), and I tried to change a parameter ('param') in the subsystems.
I wanted to set DIFFERENT value in each subsystem, SS1 and SS2, so wrote a code by using "set_param" command like this :
  • set_param('…SS1/param', 'Value', '1')
  • set_param('…SS2/param', 'Value', '2')
The paramter in SS1 can be set, but the command for SS2 generates an error like this :
  • "SS2 is locked by SS1, so the parameter in SS2 cannot be changed."
How can I avoid this problem?
Best,

回答 (1 件)

Riya
Riya 2025 年 4 月 23 日
Hi,
I understand that you are encountering an error while trying to assign different parameter values to two subsystem instances (“SS1” and “SS2”).
I tried reproducing the issue using both independent and dependent subsystems and it worked fine on my end.
Possible reasons for the error could be:
  • You might be trying to modify the blocks or connections in a way that changes the overall structure of the subsystem.
  • The subsystem could be masked or protected which limits the ability to make certain changes to it.
As a workaround, you can consider the following approaches:
  • Breaking the library links if not needed, using the following code:
set_param('myModel/SS1', 'LinkStatus', 'none');
set_param('myModel/SS2', 'LinkStatus', 'none');
  • Or, you can use Variant subsystems to allow instance-specific configurations.
For more details, refer the following documentation:
Break Links to library blocks:

カテゴリ

Help Center および File ExchangeSubsystems についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by