MATLAB: Is it possible to add a “configurable subsystem” in a library using add_block command

add_blockconfigurable subsystemsimulink

Hi,
I am trying to automatically create library parsing some text file. It works pretty good.
Of course I use add_block and set_param functions.
Now I am trying to add "configurable subsystem" in my library (using add_block) but it does not work…
Is it impossible ?
Does somebody now a way to do it ?
Thank you,
Arnaud Bonneuil

Best Answer

Hi,
here is a piece of code I use :
function test_add()
model = bdroot(gcb);
config_subsystem = strcat(model, '/config_subsystem');
add_block('configurable_subsystem/template',config_subsystem,...
'Position', [480, 104, 580, 146]);
set_param(config_subsystem,'MemberBlocks', 'config_1, config_2, config_3');
set_param(config_subsystem,'BlockChoice', 'config_1');
end
I put a configurable subsystem named "template" in a library named "configurable_subsystem.mdl". "template" block is not configured.
I can add it to my library (it contains 3 subsystems named "config_1", "config_2", "config_3") but I can not configure it.
error message is :
??? Error using ==> set_param Cannot set member block list for configurable subsystem instance 'my_lib/config_subsystem'.
Error in ==> test_add at 10 set_param(config_subsystem,'MemberBlocks', 'config_1, config_2, config_3');
Thank you for help.