版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年岳麓版选修6历史下册阶段测试试卷含答案
- 2025年华师大版选修2地理下册阶段测试试卷
- 2025年北师大新版选修5历史上册阶段测试试卷含答案
- 2025年外研版三年级起点选择性必修3历史上册月考试卷含答案
- 2025年浙教版选修6历史下册月考试卷
- 二零二五版面料行业标准制定与采购合同范本3篇
- 二零二五年度生物制药项目与派遣公司研发人员派遣合同4篇
- 二零二五版派遣人力资源管理顾问人才派遣与咨询合同4篇
- 二零二五版商业综合体租赁合同范本4篇
- 二零二五年度个人汽车租赁贷款合同范本3篇
- 选煤厂安全知识培训课件
- 项目前期选址分析报告
- 急性肺栓塞抢救流程
- 《统计学-基于Python》 课件全套 第1-11章 数据与Python语言-时间序列分析和预测
- 《形象价值百万》课件
- 红色文化教育国内外研究现状范文十
- 中医基础理论-肝
- 小学外来人员出入校门登记表
- 《土地利用规划学》完整课件
- GB/T 25283-2023矿产资源综合勘查评价规范
- 《汽车衡全自动智能称重系统》设计方案
评论
0/150
提交评论