收藏 分销(赏)

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

上传人:快乐****生活 文档编号:4362029 上传时间:2024-09-13 格式:DOC 页数:12 大小:122.50KB
下载 相关 举报
matlab课程设计(简单计算器的设计).doc_第1页
第1页 / 共12页
matlab课程设计(简单计算器的设计).doc_第2页
第2页 / 共12页
点击查看更多>>
资源描述
matlab课程设计报告 题 目 简易计算器得设计 学 院 电子信息工程学院 专 业 电子信息 学生姓名与学号 指导教师 一 、选题目得及意义 GUI得广泛应用就是当今计算机发展得重大成就之一,它极大地方便了非专业用户得使用。人们从此不再需要死记硬背大量得命令,取而代之得就是可以通过窗口、菜单、按键等方式来方便地进行操作,而在matlab有很简单得gui设计工具,我们可以通过这个工具轻松地构建我们想要得程序,从而实现与用户得信息交互。本次课程设计就是使用了matlab中得guide生成了简单得计算器程序。 二、源代码 function varargout = Calculator(varargin) %Simple Calculator %Anhui University % Begin initialization code DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', m, 、、、 'gui_Singleton', gui_Singleton, 、、、 'gui_OpeningFcn', Calculator_OpeningFcn, 、、、 'gui_OutputFcn', Calculator_OutputFcn, 、、、 'gui_LayoutFcn', [] , 、、、 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State、gui_Callback = str2func(varargin{1}); end if nargout [varargout{1: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, 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 mand line arguments to Calculator (see VARARGIN) % Choose default mand 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 mand 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 GUIDATA) % Get default mand line output from handles structure varargout{1} = 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=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 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 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、 function 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,'string',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'); 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 data (see GUIDATA) textstring=get(handles、text1,'string'); textstring=strcat(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) textstring=get(handles、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 handles 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 future 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 (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,'+'); set(handles、text1,'string',textstring) % Executes on button press in p0、 function p0_Callback(hObject, 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 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,''); 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(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 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 denghao、 function denghao_Callback(hObject, eventdata, handles) % hObject handle to denghao (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=eval(textstring); set(handles、text1,'string',textstring) % Executes on button press in clear、 function clear_Callback(hObject, eventdata, handles) % hObject 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 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 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 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. 可进行清零,退出等 三、界面设计及运行结果 11、 GUIDE 设计界面 12、进入程序初始状态 13、简单得实例测试 五、心得及体会 通过这次matlab课程设计,让我对matlab有了更深得了解。Matlab不仅给我们更方便得编程体验,其中强大得数值运算,信号处理等功能更就是我们专业实现相关系统设计得好工具。
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传
相似文档                                   自信AI助手自信AI助手

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服