matlab课程设计简单计算器的设计.docx
《matlab课程设计简单计算器的设计.docx》由会员分享,可在线阅读,更多相关《matlab课程设计简单计算器的设计.docx(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、matlab课程设计简单计算器的设计 matlab课程设计报告 题目简易计算器的设计 学院电子信息工程学院 专业电子信息 学生姓名和学号 指导教师 一、选题目的及意义 GUI的广泛应用是当今计算机发展的重大成就之一,它极大地方便了非专业用户的使用。人们从此不再需要死记硬背大量的命令,取而代之的是可以通过窗口、菜单、按键等方式来方便地进行操作,而在matlab有很简单的gui设计工具,我们可以通过这个工具轻松地构建我们想要的程序,从而实现与用户的信息交互。本次课程设计是使用了matlab中的guide生成了简单的计算器程序。 二、源代码 function varargout = Calculat
2、or(varargin) %Simple Calculator %Anhui University % Begin initialization code - DO NOT EDIT gui_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); end if 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 Calcul
4、ator_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 Ca
5、lculator (see VARARGIN) % Choose default command line output for Calculator handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes Calculator wait for user response (see UIRESUME) % uiwait(handles.figure1); % - Outputs from this function are returned to the co
6、mmand line. function 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 GUIDA
7、TA) % Get default command line output from handles structure varargout1 = 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 wit
8、h handles and user data (see GUIDATA) 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 defin
9、ed in a future version of MATLAB % handles 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 ha
10、ndle to p3 (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,3); set(handles.text1,string,textstring) % - Executes on button press in p4. functi
11、on p4_Callback(hObject, eventdata, handles) % hObject 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,strin
12、g,textstring) % - Executes on button press in p5. function p5_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);
13、textstring=strcat(textstring,5); set(handles.text1,string,textstring) % - 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 d
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 课程设计 简单 计算器 设计
限制150内