Using set_param command leads to an error about “add/delete variant blocks through call-backs”

3 views (last 30 days)
Hey guys,
i need some help with simulink. Please excuse my bad english.
I'm building an own simulink libary. I try to change a 'BlockChoice'-parameter depending on the "Radiobutton" selected to select the right hydraulic-model i want to use.
When a change appears i use the Callback/Initialization field of the mask (i tried already both) to
set_param([gcb,'some subsystems'], 'BlockChoice', 'MyChoice')
to select the right field of my "Configurable Subsystem".
When i use
get_param([gcb,'some subsystems'], 'BlockChoice')
the new choice is set correctly. When i start the simulation, simulink gives me the error
Your model tries to add/delete variant blocks through call-backs. With variant blocks we do not allow this change.
The funny thing is, when i manually "look"/navigate through all the masks, until the "Configurable Subsystem" and than start the simulation, no error accurs.
I tried an another way with
set_param([gcb,'firstChild'], 'someVariable', 'someValue')
functions to set other parameters of the childs-blocks until i reach my last block before the "Configurable Subsystem" and only the last block allow to change the value 'BlockChoice', but it doesn'thelp.
When i navigate through the children blocks and enter my "Configurable Subsystem" with the 'BlockChoice' parameter i can see that simulink is "lagging" and than changing to the right choice.
I use matlab R2016a. The library were tested on R2014b and R2015a also. Same problems.
I tried
set_param(gcs,'SimulationCommand','Update')
but my model starts to load every single time, i change something on my Mask.
Any ideas how i can tell the block, after i set the 'BlockChoice', initialize once again?
Thanks a lot

Answers (0)

Categories

Find more on Component-Based Modeling in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!