Updating Simulink Block Parameters using Matlab Scripts
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I am working on an application which involves me to write a script to automatically launch a Simulink Code and Run it.
I am able to load the model and run it using the 'Sim' command. I am also able to initialize parameters of the blocks using the 'set_param' command.
What I am not able to do is to change the values of these parameters dynamically while the Simulink Model (with end time as inf) is running? Is there a way to implement this?
E.g.:
cd C:\Users\INSL-CustED01\Desktop;
Sine_Wave;
sim('Sine_Wave');
set_param('Sine_Wave/Offset','Value','10');
Starts running the Model which has a Sine Wave Block with a Scalar 'Offset' being added to it. The model starts with an offset of 10. Now, I want to write additional commands to dynamically change the Value of Offset while the Model is running.
댓글 수: 0
답변 (1개)
Fangjun Jiang
2020년 1월 8일
set_param(YourModel, 'SimulationCommand', 'pause');
set_param(YourBlock, parameter, value);
set_param(YourModel, 'SimulationCommand', 'continue');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!