matlab课程设计(简单计算器的设计).doc

上传人:豆**** 文档编号:29959992 上传时间:2022-08-02 格式:DOC 页数:15 大小:136.50KB
返回 下载 相关 举报
matlab课程设计(简单计算器的设计).doc_第1页
第1页 / 共15页
matlab课程设计(简单计算器的设计).doc_第2页
第2页 / 共15页
点击查看更多>>
资源描述

《matlab课程设计(简单计算器的设计).doc》由会员分享,可在线阅读,更多相关《matlab课程设计(简单计算器的设计).doc(15页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

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

2、alculator%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, );if nargin & ischar(vararg

3、in1) 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 Calculator_OpeningFcn(hObject, eventd

4、ata, 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 VARARGIN) % Choose def

5、ault 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 varargout = Calcula

6、tor_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 line output from

7、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 GUIDATA)textstring=

8、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% handles structure wi

9、th 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 - to be defined in

10、 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 handle to p4

11、(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 p5_Callback(hO

12、bject, 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,textstring) % - Execu

13、tes 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(textstring,

14、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)textstring=get(ha

15、ndles.text1,string);textstring=strcat(textstring,7);set(handles.text1,string,textstring) % - Executes on button press in p8.function p8_Callback(hObject, eventdata, handles)% hObject handle to p8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with han

16、dles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,8);set(handles.text1,string,textstring) % - Executes on button press in p9.function p9_Callback(hObject, eventdata, handles)% hObject handle to p9 (see GCBO)% eventdata reserved - to be defined in a fut

17、ure version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,9);set(handles.text1,string,textstring) % - Executes on button press in add.function add_Callback(hObject, eventdata, handles)% hObject handle to add (se

18、e 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,+);set(handles.text1,string,textstring) % - Executes on button press in p0.function p0_Callback(hObje

19、ct, eventdata, handles)% hObject handle to p0 (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,0);set(handles.text1,string,textstring) % - Executes

20、 on button press in sub.function sub_Callback(hObject, eventdata, handles)% hObject handle to sub (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,

21、-);set(handles.text1,string,textstring) % - Executes on button press in div.function div_Callback(hObject, eventdata, handles)% hObject handle to div (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get

22、(handles.text1,string);textstring=strcat(textstring,/);set(handles.text1,string,textstring) % - Executes on button press in mul.function mul_Callback(hObject, eventdata, handles)% hObject handle to mul (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure wi

23、th handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,*);set(handles.text1,string,textstring) % - Executes on button press in denghao.function denghao_Callback(hObject, eventdata, handles)% hObject handle to denghao (see GCBO)% eventdata reserved - t

24、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=eval(textstring);set(handles.text1,string,textstring) % - Executes on button press in clear.function clear_Callback(hObject, eventdata, handles)% hObj

25、ect handle to clear (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) set(handles.text1,string,0) % -function exit_Callback(hObject, eventdata, handles)% hObject handle to exit (see GCBO)% eventdata reserved - to

26、be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close(gcf) % -function calculate_Callback(hObject, eventdata, handles)% hObject handle to calculate (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with

27、 handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=eval(textstring);set(handles.text1,string,textstring) % - Executes on button press in point.function point_Callback(hObject, eventdata, handles)% hObject handle to point (see GCBO)% eventdata reserved - to be defined

28、 in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,string);textstring=strcat(textstring,.);set(handles.text1,string,textstring) 设计功能:1. 可进行加减乘除四则运算2. 可进行清零,退出等 三、界面设计及运行结果1-1. GUIDE 设计界面1-2.进入程序初始状态1-3.简单的实例测试五、心得及体会通过这次matlab课程设计,让

29、我对matlab有了更深的了解。Matlab不仅给我们更方便的编程体验,其中强大的数值运算,信号处理等功能更是我们专业实现相关系统设计的好工具。15具好好设系现现专更功号号,值值强其验便便们仅不不 解解的了 我我计计课 次体及及测测实的状始始程界界设 .结行行及面 出,运四四减能能 . ). ) , ( = - ( , , - , () ( = ) . = ( , - ( - ( , - ( ( - ( - , ) ( ) ( ( - ( _ )* ) . ( , ) ( = ) ( ( , , , , )- ( = ) . = ( - - , ) = ) , ( (00 , 0 - , ()

30、 ) , ( ( - ( , ( - , ) ( = ) , _ - . ) ) ( ( , ( - , () = ) ( ( ( , ( - , ) ) ( ( - . ), ) ( ( - ( - ) ) ( ( ( , - ) = ) ( - , . ) ) , ( ( , _ - ) ( = ) . ( ( , , - ( ) ( ) -) ( ) ( . ( ( , , , ( ): _( _ ): , = : ) ( ) . , , . _ . _ . _ , . = _ ( 代 序序器算了了 用用设次互互信用现现,的们们建轻个个通们,计 单单 在在作行便方方等单窗通通的的而令命命硬死不不们人户专专非大大,就大发发机是是泛 意及及目教教学和信 学学工 设的 报报设课 15 / 15

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁