1、主界面源码: function varargout = Main(varargin) % MAIN M-file for Main.fig % MAIN, by itself, creates a new MAIN or raises the existing % singleton*. % % H = MAIN returns the handle to a new MAIN or the handle to % the existing singleton*. % % MAIN('CALLBACK',hObject,eve
2、ntData,handles,...) calls the local % function named CALLBACK in MAIN.M with the given input arguments. % % MAIN('Property','Value',...) creates a new MAIN or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Main
3、OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Main_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)".
4、 % % See also: GUIDE, GUIDATA, GUIHANDLES % Copyright 2002-2003 The MathWorks, Inc. % Edit the above text to modify the response to help Main % Last Modified by GUIDE v2.5 12-Jan-2014 09:31:12 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Na
5、me', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Main_OpeningFcn, ... 'gui_OutputFcn', @Main_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if narg
6、in && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before Main i
7、s made visible. function Main_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %
8、 varargin command line arguments to Main (see VARARGIN) % Choose default command line output for Main handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes Main wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Out
9、puts from this function are returned to the command line. function varargout = Main_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % hand
10、les structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in pushbutton_datain. function pushbutton_datain_Callback(hObject, eventdata, handles) % hObject handle to
11、 pushbutton_datain (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); run('untitled'); % --- Executes on button press in pushbutton_find. function pushbutton_find_Callback(hObject, eventd
12、ata, handles) % hObject handle to pushbutton_find (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); run('chaxuntongji'); % --- Executes on button press in pushbutton_change. function
13、 pushbutton_change_Callback(hObject, eventdata, handles) % hObject handle to pushbutton_change (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); run('change'); % --- Executes on butto
14、n press in pushbutton_delete. function pushbutton_delete_Callback(hObject, eventdata, handles) % hObject handle to pushbutton_delete (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); run
15、'shanchu'); % --- Executes during object creation, after setting all properties. function figure1_CreateFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created unt
16、il after all CreateFcns called Main=axes('units','normalized','position',[0 0 1 1]); uistack(Main,'down') II=imread('pic4.bmp'); image(II) colormap gray set(Main,'handlevisibility','off','visible','off'); % -------------------------------------------------------------------- %%funct
17、ion _Callback(hObject, eventdata, handles) % hObject handle to (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --------------------------------------------------------------------
18、function _Callback(hObject, eventdata, handles) % hObject handle to (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % ---------------------------------------------------------------
19、 %%function _Callback(hObject, eventdata, handles) % hObject handle to (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes during object deletion, before destroying p
20、roperties. function figure1_DeleteFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------
21、 function message_Callback(hObject, eventdata, handles) % hObject handle to close (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) button=msgbox({'GUI学生成绩管理系统 ';'组长:邱晴';'组员:袁媛 黄新星
22、 张婷雯 于洋 王佳浩'},'关于'); % -------------------------------------------------------------------- function close_Callback(hObject, eventdata, handles) % hObject handle to close (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles
23、and user data (see GUIDATA) button=questdlg('是否确认关闭','关闭确认','是','否','是'); if strcmp(button,'是') close; else return; end % --- Executes on button press in pushbutton_datain1. function pushbutton_datain1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton_dat
24、ain1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf); run('untitled'); 成绩查询统计源码: function varargout = chaxuntongji(varargin) % CHAXUNTONGJI M-file for chaxuntongji.fig % CHA
25、XUNTONGJI, by itself, creates a new CHAXUNTONGJI or raises the existing % singleton*. % % H = CHAXUNTONGJI returns the handle to a new CHAXUNTONGJI or the handle to % the existing singleton*. % % CHAXUNTONGJI('CALLBACK',hObject,eventData,handles,...) calls the local %
26、 function named CALLBACK in CHAXUNTONGJI.M with the given input arguments. % % CHAXUNTONGJI('Property','Value',...) creates a new CHAXUNTONGJI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before chaxuntongji_OpeningFun
27、ction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to chaxuntongji_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". %
28、 % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help chaxuntongji % Last Modified by GUIDE v2.5 11-Jan-2014 14:57:27 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ...
29、 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @chaxuntongji_OpeningFcn, ... 'gui_OutputFcn', @chaxuntongji_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1})
30、 gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before chaxuntongji is made visible.
31、function chaxuntongji_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin
32、 command line arguments to chaxuntongji (see VARARGIN) % Choose default command line output for chaxuntongji handles.output = hObject; %%[filename pathname]=uigetfile({'*.xls'},'¨'); %fin=[pathname filename]; %%xlsread([pathname filename]); %xlsread('students.xls
33、','sheet1'); % Update handles structure guidata(hObject, handles); % UIWAIT makes chaxuntongji wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = chaxuntongji_OutputFcn(hObje
34、ct, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from
35、 handles structure %%varargout{1} = handles.output; function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hin
36、ts: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edi
37、t1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'Backgr
38、oundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structur
39、e with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObj
40、ect, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC a
41、nd COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushb
42、utton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=get(handles.edit2,'string'); [data message]=xlsread('students.xls','sheet1'); m=message(:,2); l=length(data); l=l+2; for i=1:l if strcm
43、p(m(i),a) chengji=data(i-2,:); xinxi=message(i,:); set(handles.listbox1,'string',xinxi(2)); set(handles.listbox2,'string',xinxi(1)); set(handles.listbox3,'string',xinxi(3)); set(handles.listbox4,'string',xinxi(4)); set(handles.listbox5,'string',chengji(1));
44、 set(handles.listbox6,'string',chengji(2)); set(handles.listbox7,'string',chengji(3)); set(handles.listbox8,'string',chengji(4)); break else if i==l msgbox('查无此人,请重新输入','警告','warn'); set(handles.edit3,'string',''); set(handles.edit2,'string',
45、''); return end end end guidata(hObject, handles); % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future ver
46、sion of MATLAB % handles structure with handles and user data (see GUIDATA) a=get(handles.edit3,'string'); [data message]=xlsread('students.xls','sheet1'); m=message(:,1); l=length(data); l=l+2; for i=1:l if strcmp(m(i),a) chengji=data(i-2,:); xinxi=message(i,:);
47、set(handles.listbox1,'string',xinxi(2)); set(handles.listbox2,'string',xinxi(1)); set(handles.listbox3,'string',xinxi(3)); set(handles.listbox4,'string',xinxi(4)); set(handles.listbox5,'string',chengji(1)); set(handles.listbox6,'string',chengji(2)); set(handles.listbox7
48、'string',chengji(3)); set(handles.listbox8,'string',chengji(4)); break else if i==l msgbox('查无此人,请重新输入','警告','warn'); set(handles.edit3,'string',''); set(handles.edit2,'string',''); return end end end guidata(hObject,
49、handles); % --- Executes on selection change in listbox1. function listbox1_Callback(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
50、 % Hints: contents = get(hObject,'String') returns listbox1 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox1 % --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) %






