How to programmatically change Simscape block pop-up parameters?
Show older comments

There's this pop-up parameter in Simscape block, and I need to change it through commands.
However, I tried the following commands, none of them worked. While these commands caused no error at all, the simulation results were the same when the value was changed. Besides, I found that the pop-up parameters are not actually 'pop-up' type behind mask. Instead, they are 'edit' type.
% com 1
set_param(gcb,'winding_type','ee.enum.statorconnection.wye')
% com 2
mdl = "E6_PC";
open_system(mdl);
in = Simulink.SimulationInput(mdl);
in = in.setBlockParameter('E6_PC/PMSM_delta/PMSM','winding_type','ee.enum.statorconnection.wye');
out = sim(in);
Answers (1)
Sabin
on 15 Dec 2022
0 votes
You can use set_param to change the value of the dropdown:
>> set_param(gcb,'winding_type','ee.enum.statorconnection.wye')
>> set_param(gcb,'winding_type','ee.enum.statorconnection.delta')
Alternatively you can use the numerical values:
>> set_param(gcb,'winding_type','1') % wye
>> set_param(gcb,'winding_type','2') % delta
Categories
Find more on Variable Initialization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!