How to programmatically change Simscape block pop-up parameters?

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);

답변 (1개)

Sabin
Sabin 2022년 12월 15일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Variable Initialization에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 7월 7일

답변:

2022년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by