Borrar filtros
Borrar filtros

How to run simulink from matlab script, pause the simulation, change constant values, and continue the simulation

1 visualización (últimos 30 días)
Hi all, I want to run a simulation from a matlab script (or function) using workspace variables as parameter values for constant blocks in the simulation. I want to be able to pause the simulation at a specific time (say 10 seconds in) and change the value of the constant, then resume the simulation. Is there a way to do this. As a simple descriptive example, lets say I have a simulation which plots A*sin(wt) in a scope. 'A' and 'w' are constant blocks with values which are defined in the workspace with A=1 and w=1. At 1 second into the simulation, I want to pause it and change A=2, then continue the simulation. Is it possible to do this in a matlab script? If so, please let me know how.

Respuestas (1)

kintali narendra
kintali narendra el 23 de Sept. de 2016
"sim" is the name of the function which can run the simulation from through programming. check the link below for more details
https://www.mathworks.com/help/simulink/ug/using-the-sim-command.html
  1 comentario
Michael Palmer
Michael Palmer el 24 de Sept. de 2016
Thanks Kintali, I know about the "sim" command; however, I am unsure how to subsequently pause the simulation, change constant values (in the script), and resume. Do you know how this is accomplished?

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by