Setting initial condition of simulink integrator through code
Mostrar comentarios más antiguos
Hi,
I am trying to cchange the initial condition of an integrator in Simulink by using Matlab code. I am using the following lines:
init_cond_integrator=[pi/3;0];
set_param('ClosedLoop_PID_MRFT_with_actuator/Manipulator Dynamics/Integrator1','InitialCondition',num2str(init_cond_integrator));
It gives the following error:
'ClosedLoop_PID_MRFT_with_actuator/Manipulator Dynamics/Integrator1' has unapplied changes. Please apply or cancel these changes before running the simulation.

Any help will be highly appreciated.
Thanks!
Respuestas (1)
Fangjun Jiang
el 21 de Jul. de 2020
0 votos
The error message says you have the dialog window open and changes have not been applied. Click apply or Ok and then proceed.
4 comentarios
Ahmed Rehan
el 22 de Jul. de 2020
Fangjun Jiang
el 22 de Jul. de 2020
Editada: Fangjun Jiang
el 22 de Jul. de 2020
Most likely, the value needs to be [1.0472; 0], not as shown 1.0472 0
Ahmed Rehan
el 24 de Jul. de 2020
Fangjun Jiang
el 24 de Jul. de 2020
set_param(Block,'InitialCondition',mat2str([1,2]))
Categorías
Más información sobre Programmatic Model Editing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!