set_param invalid setting error

11 views (last 30 days)
Alberto
Alberto on 15 Feb 2024
Commented: Alberto on 19 Feb 2024
I'm trying to set the variant subsystem of a simulink model from matlab, by the set_param function.
The model has some already done subsystems and I added 2 new subsystems (test1 and test2); If I set one of the already done subsystems it works, but if I try to set one of the new variant subsystems it doesn't works.
I called the new subsystems test1 and test2, also in the variant choice table of the block parameter.
If I use this command it works:
set_param(['sm_car' '/World'],'popup_scene','Road Two Lane');
but with this command it doesn't works:
>> set_param(['sm_car' '/World'],'popup_scene','test1');
The error is:
Invalid setting in Environment block (mask) 'World' for parameter 'popup_scene'
Caused by:
Option specified is not valid.
Why?

Accepted Answer

Mark McBroom
Mark McBroom on 17 Feb 2024
It looks like you have a mask on a subsystem and are using that mask to control the variant choice. You need to associate that mask variable with the variant selection. This link shows a couple of different ways to do this. The first example looks like what you need.
  1 Comment
Alberto
Alberto on 19 Feb 2024
Thank you so much! Just needed to add the new scene names in the mask parameter type options!

Sign in to comment.

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!