How to change Simulink constant block value to a constant variable?
118 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sumin
am 10 Jun. 2014
Kommentiert: sherif Gad
am 12 Nov. 2021
Hello,
I'm trying to find a way to set constant value in constant block in Simulink to a constant variable. Namely, I want to set the constant value to g*c/3. g and c values are optimized by fmincon and determined.
In MATLAB, I tried to write something like
>> set_param([simfilename '/Constant2'],'Constant value',num2str(gc/3));
The constant block in Simulink has been named as "Constant2".
What I'm trying to achieve is to have this constant block output different numerical outputs according to g and c values determined by fmincon.
Thank you.
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 12 Jun. 2014
set_param([simfilename '/Constant2'],'Value', num2str(gc/3));
1 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!