Borrar filtros
Borrar filtros

Control simulink model with Matlab

8 visualizaciones (últimos 30 días)
George
George el 27 de Ag. de 2013
Dear all,
I would like to know if it is possible to control the simulink options from matlab. What I would like to do is to change values in a structure placed in a constant block.
The only way I have found for the moment is to pause the simulation, change the values, use update diagram and play the simulation again.
Could someone tel me if possible how to use the update diagram from a Matlab script. You can find the update diagram in Simulink\Simulation\UpdateDiagram
Thank you,
George

Respuestas (2)

David Sanchez
David Sanchez el 27 de Ag. de 2013
Use the set_param function. For a model called test, with a constant block named "Constant_2" on it, you can use:
my_value = '3';
set_param('test/Constant_2','Value', my_value);
to set its value to my_value.
Similar to any other block, you just have to find the name of the option within the block to be changed.

George
George el 27 de Ag. de 2013
Thank you for your help.
I also found how to do the update with set param: set_param('model','simulationcommand','update')

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by