MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   我在从GUI执行simulink时遇到问题,谁知道这是怎么回事? (https://www.labfans.com/bbs/showthread.php?t=22333)

poster 2019-12-02 11:00

我在从GUI执行simulink时遇到问题,谁知道这是怎么回事?
 
我试图从GUI的编辑文本中绘制“ t vs y”设置的一些值,其中之一以“ tfinal”作为“停止时间”,但是当我运行代码时,它不会替换它,并在出现以下错误时显示尝试更换它:(*希望您能帮助我)

Error evaluating expression 'tfinal' for 'StopTime' specified in the Configuration Parameters dialog for block diagram 'gui_sim_model'. . . . Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_adv_sim('pushbutton1_Callback',hObject,eventdata,guidata(hObject)) - Show complete stack trace Caused by: Error using gui_adv_sim>pushbutton1_Callback (line 184) Unrecognized function or variable 'tfinal'. - Showcomplete stack trace Error using gui_adv_sim>pushbutton1_Callback (line 184) Variable 'tfinal' has been deleted from base workspace. Gui中的代码(按钮):

function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global tfinal vfinal abty tfinal = str2double(get(handles.tf,'String')); vfinal = str2double(get(handles.vf,'String')); a = str2double(get(handles.aval,'String')); b = str2double(get(handles.bval,'String')); sim('gui_sim_model'); axes(handles.axes1) plot(t,y) xlabel('time in seconds') ylabel('value of y') Simulink: [URL="https://i.stack.imgur.com/IchLG.png"]https[/URL] : [URL="https://i.stack.imgur.com/IchLG.png"]//i.stack.imgur.com/IchLG.png[/URL]

界面: [URL="https://i.stack.imgur.com/T08lf.png"]https[/URL] : [URL="https://i.stack.imgur.com/T08lf.png"]//i.stack.imgur.com/T08lf.png[/URL]



[url=https://stackoverflow.com/q/59132039]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:23

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.