资源描述
主界面源码:
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,eventData,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_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)".
%
% 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_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Main_OpeningFcn, ...
'gui_OutputFcn', @Main_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && 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 is 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)
% 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);
% --- Outputs 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
% handles 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 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, eventdata, 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 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 button 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('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 until 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');
% --------------------------------------------------------------------
%%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)
% --------------------------------------------------------------------
%%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)
% --------------------------------------------------------------------
%%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 properties.
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)
% --------------------------------------------------------------------
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学生成绩管理系统 ';'组长:邱晴';'组员:袁媛 黄新星 张婷雯 于洋 王佳浩'},'关于');
% --------------------------------------------------------------------
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 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_datain1 (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
% CHAXUNTONGJI, 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
% 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_OpeningFunction 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)".
%
% 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, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @chaxuntongji_OpeningFcn, ...
'gui_OutputFcn', @chaxuntongji_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && 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 chaxuntongji is made visible.
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 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','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(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
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from 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)
% Hints: 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 edit1 (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,'BackgroundColor'), 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 structure 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(hObject, 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 and 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 pushbutton1 (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 strcmp(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));
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','');
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 version 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,:);
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,'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, 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)
% 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)
%
展开阅读全文