我在 MATLAB 中开发了一个 GUI 界面。当我按下按钮搜索时,我看到了理想的结果。但是,当我更改文本框并再次按下搜索按钮时,它不起作用并给我以下错误:
Undefined function 'untitled2' for input arguments of type 'struct'.
Error in @(hObject,eventdata)untitled2('edit1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Undefined function 'untitled2' for input arguments of type 'struct'.
Error in @(hObject,eventdata)untitled2('pushbutton16_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
我必须重新执行所有代码!有什么方法可以重复运行 GUI?
如图所示,当我将视频 ID 更改为其他数字并按下搜索按钮时,结果不会更新。
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%pathname='C:\Users\Dr Syed Abdul Rahman\Desktop\innovation final\video detail\';
string1 = get(handles.edit1,'UserData');
fName=strcat(cd,'\Video Detail\Video Detail',string1);
fid = fopen(fName);
if fid~=-1
s{1} = fgetl(fid);
s{2} = fgetl(fid);
s{3} = fgetl(fid);
s{4} = fgetl(fid);
s{5} = fgetl(fid);
s{6} = fgetl(fid);
s{7} = fgetl(fid);
set(handles.text4,'Visible','On');
set(handles.edit1,'Visible','On','String',s{1})
set(handles.edit2,'Visible','On','String',s{2})
set(handles.edit3,'Visible','On','String',s{3})
set(handles.edit4,'Visible','On','String',s{4})
set(handles.edit5,'Visible','On','String',s{5})
set(handles.edit6,'Visible','On','String',s{6})
set(handles.edit7,'Visible','On','String',s{7})
set(handles.axes4,'Visible','On');
cd './Images';
A = imread(s{1});
axes(handles.axes4)
imshow(A);
else
set(handles.text3,'Visible','On','String','File is not exist !')
end