
how to update constant value block from workspace simultaneously?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Gayathri
le 11 Fév 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 commentaires
Voir également
Catégories
En savoir plus sur Model, Block, and Port Callbacks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!