
how to update constant value block from workspace simultaneously?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Gayathri
am 11 Feb. 2025
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 Kommentare
Siehe auch
Kategorien
Mehr zu Model, Block, and Port Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!