
how to update constant value block from workspace simultaneously?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi, The problem which I encounter is when I update value from workspace, I have to update twice to get the value which I want, because the previous value still there when I press first time. so how to update constant value block from workspace simultaneously? thanks beforehand!
댓글 수: 0
답변 (1개)
Gayathri
2025년 2월 11일
To ensure that the value in the constant block gets updated simultaneously when you change the workspace variable, we can use the "set_param" function to update the model. Please see the below command which gives an example of the function usage.
set_param(model,'SimulationCommand','Update')
You can either run this command in the command window or use this command in the model callbacks to ensure that the model is updated whenever necessary. We can use the "InitFcn" callback in "Modelling > Model Properties > Callbacks" to update the value before simulation starts as shown below.

For more information on the "set_param" function, please use the below command.
doc set_param
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Model, Block, and Port Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!