How to programmatically modify parameters in the workspace

조회 수: 6 (최근 30일)
余骏雄
余骏雄 2024년 11월 13일
편집: Madheswaran 2024년 11월 13일
"How can I programmatically modify the value of ECMS-s in the model workspace?

답변 (1개)

Madheswaran
Madheswaran 2024년 11월 13일
편집: Madheswaran 2024년 11월 13일
Hi,
Here's how you can programmatically modify the Simulink Model Workspace:
my_model = 'HevP2OptimalController';
load_system(my_model);
modelWorkspace = get_param(my_model, 'ModelWorkspace');
assignin(modelWorkspace, 'ECMS_s', 5);
save_system(my_model);
close_system(my_model, 1);
For more information, refer to the following documentations:
  1. https://mathworks.com/help/simulink/slref/get_param.html
  2. https://mathworks.com/help/matlab/ref/assignin.html
  3. https://mathworks.com/help/simulink/slref/save_system.html
Hope this helps!

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by