Can we call a m-script during model simulation ?:

1 visualización (últimos 30 días)
Ajay Pherwani
Ajay Pherwani el 11 de Feb. de 2014
Comentada: Ajay Pherwani el 17 de Jun. de 2014
I want to run a script , which will update some of my parameters in the workspace. Is it possible to call a m-script during model simulation .
I have heard of call back functions like StartFnc and CloseFcn,
But my concern is, when a block is hit (active) in simulation , Can we can a script at that particular point ?
Is there any matlab block in simulink to call a m-script ?
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 11 de Feb. de 2014
Do you want to change some parameters in your Simulink model during simulation?

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 11 de Feb. de 2014
Editada: Azzi Abdelmalek el 11 de Feb. de 2014
You can control your simulink model from a script file
set_param('modelname', 'SimulationCommand', 'start') % To start your simulation
% Then change your parameters in workspace
set_param('modelname', 'SimulationCommand', 'update') % will update your Simulink parameters
You can also change the parameters in your blocks by using set_param. Look at this example
  1 comentario
Ajay Pherwani
Ajay Pherwani el 17 de Jun. de 2014
I have used mask initialization of a sub-system and call m-script that will solve the purpose . But yes it will run only once at simulation start. Thanks for your comment !!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modeling 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