有下列xls成绩表要求用matlab设计GUI要求导入xls,能够查询某同学的分数设计运行效果图如下:关键程序:导入数据按钮下的callback函数:functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)[FileNamePathName]=uigetfile({'*.xls'},'Chooseafile');str=[PathNameFileName];set(handles.edit1,'string',str);[data,text_data]=xlsread(str);handles.data=data;handles.text=text_data;guidata(hObject,handles);查询按钮下的callback函数functionpushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str=get(handles.edit3,'string');str_temp=str2num(str);index=find(handles.data(:)==str_temp);[i,j]=ind2sub(size(handles.data),index);str1=handles.data(i,:);str11=[];forix=1:size(handles.data,2)str11=strcat(str11,num2str(str1(ix)));endset(handles.edit2,'string',str);set(handles.edit4,'string',num2str(str1(2)));set(handles.edit5,'string',num2str(str1(3)));set(handles.edit6,'string',num2str(str1(4)));set(handles.edit7,'string',num2str(str1(5)));set(handles.edit8,'string',num2str(str1(6)));在初始化函数中添加:functionstudent_core_view_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstostudent_core_view(seeVARARGIN)%Choosedefaultcommandlineoutputforstudent_core_viewhandles.output=hObject;handles.data=[];handles.text=[];%Updatehandlesstructureguidata(hObject,handles);