Clear Filters
Clear Filters

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

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!