% --- Executes on button press in Load_score. functionLoad_score_Callback(hObject, eventdata, handles) % hObject handle to Load_score (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global NUM TXT RAW % 打开成绩表 [filename, pathname] = uigetfile({'*.xls'; '*.xlsx'}); full_name = strcat(pathname,filename); % 导入成绩表信息 [NUM,TXT,RAW] = xlsread(full_name); % 显示表格信息(路径、班级人数、课程数) set(handles.Load_state,'string',full_name); set(handles.Stu_num,'string',num2str(size(RAW,1)-1)); set(handles.Course_num,'string',num2str(size(RAW,2)-2));
% --- Executes on button press in Compute_GPA. functionCompute_GPA_Callback(hObject, eventdata, handles) % hObject handle to Compute_GPA (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global NUM RAW; global GPA; % 获取课程名和课程学分 [~, credit] = get_course_credit(RAW); % 计算绩点 [GPA,~] = compute_GPA(NUM,credit); msgbox('计算完成');
% --- Executes on button press in Write_to_xls. functionWrite_to_xls_Callback(hObject, eventdata, handles) % hObject handle to Write_to_xls (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global RAW; global GPA; sorted_result = Sort_result(RAW, GPA); xlswrite('sorted_GPA_result.xls',sorted_result); msgbox('已导出至当前路径:sorted_GPA_result.xls');
% --- Executes on button press in Quit. functionQuit_Callback(hObject, eventdata, handles) % hObject handle to Quit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf);