matlab课程设计汇本(简单计算器的设计)_第1页
matlab课程设计汇本(简单计算器的设计)_第2页
matlab课程设计汇本(简单计算器的设计)_第3页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、matlab课程设计报告题目 学院 专业简易计算器的设计 电子信息工程学院 电子信息学生和学号指导教师i / ii一、选题目的及意义GUI的广泛应用是当今计算机开展的重大成就之一,它极方便了非专业用户的使用。人们从此不再需要死记硬背大量的命令, 取而代之的 是可以通过窗口、菜单、按键等方式来方便地进展操作,而在matlab 有很简单的gui设计工具,我们可以通过这个工具轻松地构建我们想 要的程序,从而实现与用户的信息交互。本次课程设计是使用了 matlab中的guide生成了简单的计算器程序。、源代码fun cti on varargout = Calculator(vararg in)%Si

2、mple Calculator %An hui Uni versity% Begin initialization code - DO NOT EDIT gui_S in glet on = 1; gui_State = struct(gui_Name:mfile name,.'gui_S in glet on', gui_S in glet on, 'gui_Ope nin gF; Calculator_Ope nin gF,.'gui_OutputF', Calculator_OutputF,. 'gui_LayoutF',.'

3、;gui_Callback; );if nargin && ischar(varargin1) gui_State.gui_Callback = str2fu nc(varargi n1); endif n argout varargout1:nargout = gui_mainf(gui_State, varargin:); else gui_mai nf(gui_State, varargi n:); end % End initialization code - DO NOT EDIT% - Executes just before Calculator is made

4、visible. fun ctio n Calculator_Ope nin gF(hObject, eve ntdata, han dles, varargi n) % This fun cti on has no output args, see OutputF. % hObject han dle to figure % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) % va

5、rargin mand line argume nts to Calculator (see VARARGIN)% Choose default mand line output for Calculator han dles.output = hObject;% Update han dles structure guidata(hObject, han dles);% UIWAIT makes Calculator wait for user respo nse (see UIRESUME) % uiwait(ha ndles.figure1);% - Outputs from this

6、function are returned to the mand line, fun ctio n varargout = Calculator_OutputF(hObject, eve ntdata, han dles) % varargout cell array for returni ng output args (see VARARGOUT);% hObject han dle to figure % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB% han dles structure wit

7、h han dles and user data (see GUIDATA)% Get default mand line output from han dles structure varargout1 = han dles.output;% - Executes on butt on press in p1. function p1_Callback(hObject, eventdata, handles)% hObject han dle to p1 (see GCBO) % eve ntdata reserved - to be defi ned in a future vers i

8、on of MATLAB% han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring, '1');set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p2. function p2_Callback(hObject, eventdata, han

9、dles)% hObject han dle to p2 (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB% han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng');textstring=strcat(textstring, '2'); set(ha ndles.text1,'stri ng

10、9; ,textstri ng)3 / 11% - Executes on butt on press in p3. fun cti on p3_Callback(hObject, eve ntdata, han dies)% hObject han dle to p3 (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dies structure with han dies and user data (see GUIDATA) textstri ng=get(ha nd

11、les.text1,'stri ng');textstring=strcat(textstring, 3); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p4. function p4_Callback(hObject, eventdata, handles)% hObject han dle to p4 (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATL

12、AB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng');textstring=strcat(textstring, '4'); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p5. function p5_Callback(hObject, eventdata, handles)% hO

13、bject han dle to p5 (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng');textstring=strcat(textstring, '5'); set(ha ndles.text1,'stri ng' ,texts

14、tri ng)% - Executes on butt on press in p6. function p6_Callback(hObject, eventdata, handles)% hObject han dle to p6 (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri

15、 ng'); textstring=strcat(textstring, '6');set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p7. function p7_Callback(hObject, eventdata, handles)% hObject han dle to p7 (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han

16、dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng');textstring=strcat(textstring, '7'); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p8.fun cti on p8_Callback(hObject, eve ntdata, han dies)% hObject

17、han dle to p8 (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dies structure with han dies and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring, '8');set(ha ndles.text1,'stri ng' ,textstri n

18、g)% - Executes on butt on press in p9. function p9_Callback(hObject, eventdata, handles) % hObject han dle to p9 (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng

19、'); textstring=strcat(textstring, 9);set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in add. function add_Callback(hObject, eventdata, handles) % hObject han dle to add (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles str

20、ucture with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring,'+');set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in p0. function pO_Callback(hObject, eventdata, handles) % hObject han dle to

21、pO (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring, '0'); set(ha ndles.text1,'stri ng' ,textstri ng)% - Exec

22、utes on butt on press in sub. fun cti on sub_Callback(hObject, eve ntdata, han dles) % hObject handle to sub (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'

23、;); textstring=strcat(textstring,'-'); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in div.5 / 11fun ctio n div_Callback(hObject, eve ntdata, han dies)% hObject handle to div (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB %

24、 han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring,'/'); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in mul.function mul_Callback(hObject, eventdata, handles)% hObje

25、ct han dle to mul (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion of MATLAB % han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha ndles.text1,'stri ng'); textstring=strcat(textstring, '*'); set(ha ndles.text1,'stri ng' ,textst

26、ri ng)% - Executes on butt on press in den ghao. fun cti on den ghao_Callback(hObject, eve ntdata, han dles) % hObject han dle to den ghao (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB% han dles structure with han dles and user data (see GUIDATA) textstri ng=get(ha

27、 ndles.text1,'stri ng'); textstrin g=eval(textstri ng); set(ha ndles.text1,'stri ng' ,textstri ng)% - Executes on butt on press in clear. function clear_Callback(hObject, eventdata, handles)% hObject handle to clear (see GCBO) % eve ntdata reserved - to be defi ned in a future vers i

28、on of MATLAB% han dles structure with han dles and user data (see GUIDATA)set(ha ndles.text1,'stri ng' ,'0')%fun ctio n exit_Callback(hObject, eve ntdata, han dles)% hObject handle to exit (see GCBO) % eve ntdata reserved - to be defi ned in a future vers ion of MATLAB% han dles structure with han dles and user data (see GUIDATA) close(gcf)%fun cti on calculate_Callback(hObject, eve ntdata, han dies) % hObj

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论