基于matlab学生成绩查询GUI设计

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

有下列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);

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功