How to run simulink model from gui written in script?

3 Ansichten (letzte 30 Tage)
Arun Badigannavar
Arun Badigannavar am 7 Dez. 2012
I am running my simulink models from GUI,where Gui i have developed using MATLAB script,,,,and am controlling my stop time of both models through script ,,but am unable to do this,, Getting error like""""""Error using FinalTest/pushbutton2_Callback (line 115) Invalid StopTime specified in the Configuration Parameters dialog for block diagram 'course_speed_position'
Error while evaluating uicontrol Callback"""""This is my error ,,anybody help me?
  4 Kommentare
Arun Badigannavar
Arun Badigannavar am 7 Dez. 2012
for i=1:25;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, set_param('course_speed_position','StopTime', 'i'),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,end,,,,,,,,,,,,,This is how am setting it
Arun Badigannavar
Arun Badigannavar am 7 Dez. 2012
in set-param if i give constant value it ill work nut i want control it throuh vqariable

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

TAB
TAB am 7 Dez. 2012
Bearbeitet: TAB am 7 Dez. 2012
Try this, set_param() expect the value in string. So convert the value of i to string then pass it to set_param().
for i=1:25
set_param('course_speed_position','StopTime', sprintf('%d',i));
end

Weitere Antworten (1)

Muruganandham Subramanian
Muruganandham Subramanian am 7 Dez. 2012
Bearbeitet: Muruganandham Subramanian am 7 Dez. 2012
Through script, you can do this by before using sim('your model name'); Mention the Tstop=10 or any, then you can change this value for your need...
  1 Kommentar
Arun Badigannavar
Arun Badigannavar am 7 Dez. 2012
for i=1:1:25; set_param('course_speed_position','StopTime', 'i'); set_param('course_speed_position1','StopTime', 'i'); % pause(0.) simOut = sim('C:\Documents and Settings\admin\Desktop\New Folder (5)\02_12_2012(Simulink blocks)\Resolved Models\Speed+Position+Course\course_speed_position.mdl'); simOut1 = sim('C:\Documents and Settings\admin\Desktop\Trial Testing\course_speed_position1.mdl'); end,,,,this is how am settingg the stop time ,,,

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programmatic Model Editing 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!

Translated by