matlab课程设计(简单计算器的设计)(10页).doc
《matlab课程设计(简单计算器的设计)(10页).doc》由会员分享,可在线阅读,更多相关《matlab课程设计(简单计算器的设计)(10页).doc(10页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-matlab课程设计(简单计算器的设计)-第 10 页matlab课程设计报告题 目简易计算器的设计学 院电子信息工程学院专 业电子信息学生姓名和学号指导教师一 、选题目的及意义 GUI的广泛应用是当今计算机发展的重大成就之一,它极大地方便了非专业用户的使用。人们从此不再需要死记硬背大量的命令,取而代之的是可以通过窗口、菜单、按键等方式来方便地进行操作,而在matlab有很简单的gui设计工具,我们可以通过这个工具轻松地构建我们想要的程序,从而实现与用户的信息交互。本次课程设计是使用了matlab中的guide生成了简单的计算器程序。二、源代码function varargout = Cal
2、culator(varargin)%Simple Calculator%Anhui University% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, Calculator_OpeningFcn, . gui_OutputFcn, Calculator_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );
3、if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before Calculator is made visible.function Calculator_Ope
4、ningFcn(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 Calculator (see
5、 VARARGIN)% Choose default command line output for Calculatorhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes Calculator wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function
6、varargout = Calculator_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
7、 line output from handles structurevarargout1 = handles.output;% - Executes on button press in p1.function p1_Callback(hObject, eventdata, handles)% hObject handle to p1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GU
8、IDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,1);set(handles.text1,string,textstring)% - Executes on button press in p2.function p2_Callback(hObject, eventdata, handles)% hObject handle to p2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% hand
9、les structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,2);set(handles.text1,string,textstring)% - Executes on button press in p3.function p3_Callback(hObject, eventdata, handles)% hObject handle to p3 (see GCBO)% eventdata reserved - t
10、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,3);set(handles.text1,string,textstring)% - Executes on button press in p4.function p4_Callback(hObject, eventdata, handles)% hObject
11、 handle to p4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,4);set(handles.text1,string,textstring)% - Executes on button press in p5.function p
12、5_Callback(hObject, eventdata, handles)% hObject handle to p5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,5);set(handles.text1,string,textstri
13、ng)% - Executes on button press in p6.function p6_Callback(hObject, eventdata, handles)% hObject handle to p6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat
14、(textstring,6);set(handles.text1,string,textstring)% - Executes on button press in p7.function p7_Callback(hObject, eventdata, handles)% hObject handle to p7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textst
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 课程设计 简单 计算器 设计 10
限制150内