How to change a block's parameter in a pause and make it affect the simulation straight away?

1 vue (au cours des 30 derniers jours)
Hi,
I try to control the simulink simulation flow from a script. There is a constant block in my blockdiagram, which I would like to change its value at each sampling instance.
Here is the algorithm I use:
At each sampling instant k an assertion block in Simulink sets the 'SimulationCommand' to 'pause' so that the simulink blockdiagram pauses at time k. Then, the script sets the value parameter of the constant block which samples at Ts, updates and continues the flow.
Every thing is Okey but that the change to the value of the block does not take effect instantly. It actually influences the simulation since the next sampling instance that is k + Ts.
I look for ways to make the change affect the simulation instantly. Please advise if you think you have an idea.
By the way, I tried to update the diagram after each usage of 'set-param' command but it seems that it has no effect on the block's state.
Thank you,
Pouya

Réponses (0)

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by