How to programmatically change Simscape block pop-up parameters?
Mostrar comentarios más antiguos

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);
Respuestas (1)
Sabin
el 15 de Dic. de 2022
0 votos
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
Categorías
Más información sobre Variable Initialization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!