how to use run-time object in simulink model?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I would like to control my simulink model from a matlab script by using set_param. And I would like to have some pause time in between. If I use pause(), the pausing time will be a real time. However, I would like to pause it according to simulation. For example: I would to set_param at simulation time = 5. And someone recommend me to use a 'run-time object'. And I have no idea how can I use it. Can someone give me an example of using the run-time object?
0 Commenti
Risposte (1)
jpai
il 25 Lug 2017
By the looks of it you want to be able to pause a running simulation through a command. It may not be necessary for you to use a run-time object at all in order to achieve the operation that you desire. As a matter of fact, you can continue using set_param to control your simulation.
For your specific case, you can use:
set_param('mymodel','SimulationCommand','pause')
This will pause the currently running model mymodel (or whatever your running model's name is).
To continue running the model, you can simply use:
set_param('mymodel', 'SimulationCommand','continue')
As the third parameter suggests, this will resume the paused model.
For more information on SimulationCommands, please refer to the following link:
https://www.mathworks.com/help/releases/R2017a/simulink/slref/model-parameters.html (Search for "SimulationCommand" in the Model Parameters table)
Hope this helps!
Vedere anche
Categorie
Scopri di più su Programmatic Model Editing 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!