Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我试图从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: https : //i.stack.imgur.com/IchLG.png 界面: https : //i.stack.imgur.com/T08lf.png 更多&回答... |
![]() |
![]() |