Setting initial condition of simulink integrator through code

7 Ansichten (letzte 30 Tage)
Ahmed Rehan
Ahmed Rehan am 21 Jul. 2020
Kommentiert: Fangjun Jiang am 24 Jul. 2020
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!

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 21 Jul. 2020
The error message says you have the dialog window open and changes have not been applied. Click apply or Ok and then proceed.
  4 Kommentare
Ahmed Rehan
Ahmed Rehan am 24 Jul. 2020
Yes, right, but that seems undoable using the set_param command.
Fangjun Jiang
Fangjun Jiang am 24 Jul. 2020
set_param(Block,'InitialCondition',mat2str([1,2]))

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by