1 简介
信息技术正在逐步深入,广泛的应用到教育管理中,在技术上管理信息系统的实施已逐步成熟.要发展学校信息系统,要高效率地有机地组织内部信息,尤其是进行深化,细致的分析成绩信息,就必须根据自身特点建立相适应的学生成绩管理统计,分析系统.本系统采用"自上而下地总体规划,自下而上地应用开发"的策略,介绍了在matlab境下开发一个管理信息系统的过程.创建了一套行之有效的计算机管理学生成绩的方案.
2 部分代码
function varargout = chengji(varargin)gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @chengji_OpeningFcn, ...'gui_OutputFcn', @chengji_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before chengji is made visible.function chengji_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;Hc_grid=uicontrol(gcf,'style','toggle','string','Grid','position',[650 165 60 29],'callback','grid');%在图形窗口画网格线guidata(hObject, handles);function varargout = chengji_OutputFcn(hObject, eventdata, handles)varargout{1} = handles.output;% --- Executes on selection change in listbox1.function listbox1_Callback(hObject, eventdata, handles)value=get(hObject,'value')-1;if(value==0)set(handles.edit1,'string','please choose a name'); %显示成绩elseset(handles.edit1,'string',num2str(handles.chengji(value,:)));%确保edit1中是数字end% --- Executes during object creation, after setting all properties.function listbox1_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit1_Callback(hObject, eventdata, handles)function edit1_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit2_Callback(hObject, eventdata, handles)function edit2_CreateFcn(hObject, eventdata, handles)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)[FileName PathName]=uigetfile({'*.xls','Excel Files(*.xls)';'*.txt','Text Files(*.txt)';'*.*','All Files(*.*)'},'Choose a file');%uigetfile用来选择读入的文件L=length(FileName);if(L<5)errordlg('请选择正确文件','File Open Error');%建立一个默认参数的错误对话框return;endtest=FileName(1,end-3:end);%定义一个变量test用于文件类型的确定str=[PathName FileName];set(handles.edit2,'string',str);%使打来的文件路径和文件名显示在edit2global len;global ave1;global ave2;global ave3;global d1;global d2;global d3;switch testcase '.txt' %当文件为记事本时fin=fopen('chengji.txt','r');str=fgetl(fin);%按行从文件中读取数据,但不读取换行符[str1 str2 str3 str4]=strread(str,'%s %s %s %s','delimiter',' ');%delimiter用于指定分隔符;%s:输出字符串xingming(1)=str1;%就是单词namecounter=2;h=waitbar(0,'please wait a moment,reading the file now ............');for i=1:100,waitbar(i/100,'h',[num2str(i),'%'])%显示百分比pause(.1)endwhile feof(fin)==0 %feof判断是否为文件结尾str=fgetl(fin);[name chinese math english]=strread(str,'%s %d %d %d','delimiter',' ');% %d用于输出十进制数xingming(counter)=name;%读取学生姓名chengji(counter-1,:)=[chinese math english];%定义一个成绩的矩阵用于储存成绩counter=counter+1;waitbar(counter/(counter+1),h,'On working......');endwaitbar(1,h,'Finished');delete(h);%读取数据完成后释放h对象set(handles.listbox1,'string',xingming);handles.chengji=chengji;len=length(chengji);%求矩阵的长度d1=chengji(1:len,1);ave1=sum(d1);%求语文的总分d2=chengji(1:len,2);ave2=sum(d2);%求数学的总分d3=chengji(1:len,3);ave3=sum(d3);%求英语的总分fclose(fin);%当文件格式为表格时case '.xls' %当文件为表格时h=waitbar(0,'please wait a moment');%创建一个进度条for i=1:100,waitbar(i/100,h,[num2str(i),'%'])%显示百分比pause(.1)endwaitbar(1,h,'Finished');delete(h);[chengji xingming]=xlsread(str);set(handles.listbox1,'string',xingming(:,1));handles.chengji=chengji;len=length(chengji);%求矩阵的长度d1=chengji(1:len,1);ave1=sum(d1);%求语文的总分d2=chengji(1:len,2);ave2=sum(d2);%求数学的总分d3=chengji(1:len,3);ave3=sum(d3);%求英语的总分otherwiseerrordlg('Wrong File','File Open Error');returnendguidata(hObject,handles);% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)clc;clear all;close(gcf);function pushbutton1_CreateFcn(hObject, eventdata, handles)function popupmenu1_Callback(hObject, eventdata, handles)val=get(hObject,'Value');str=get(hObject,'String');global len;global d1;global d2;global d3;global d;global ave1;global ave2;global ave3;global ave;switch str{val}case 'chinese'd=d1;ave=ave1/len;%求语文的平均分case 'math'd=d2;ave=ave2/len;%求数学的平均分case 'english'd=d3;ave=ave3/len;%求英语的平均分endguidata(hObject,handles);function popupmenu1_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end
3 仿真结果

4 参考文献
[1]张颖. 学生成绩统计,分析软件的设计与实现[D]. 内蒙古师范大学, 2011.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
本文探讨了如何利用Matlab技术构建一套高效的学生成绩管理统计与分析系统,通过自上而下的规划和自下而上的开发策略,实现了成绩数据的导入、处理与可视化。系统包括数据输入、成绩查看、平均分计算等功能,适用于教育管理中的成绩分析需求。
1251

被折叠的 条评论
为什么被折叠?



