
how to update constant value block from workspace simultaneously?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Gayathri
il 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 Commenti
Vedere anche
Categorie
Scopri di più su Model, Block, and Port Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!