用MATLAB实现计算器程序源代码.docx

上传人:小飞机 文档编号:3658253 上传时间:2023-03-14 格式:DOCX 页数:5 大小:36.86KB
返回 下载 相关 举报
用MATLAB实现计算器程序源代码.docx_第1页
第1页 / 共5页
用MATLAB实现计算器程序源代码.docx_第2页
第2页 / 共5页
用MATLAB实现计算器程序源代码.docx_第3页
第3页 / 共5页
用MATLAB实现计算器程序源代码.docx_第4页
第4页 / 共5页
用MATLAB实现计算器程序源代码.docx_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《用MATLAB实现计算器程序源代码.docx》由会员分享,可在线阅读,更多相关《用MATLAB实现计算器程序源代码.docx(5页珍藏版)》请在三一办公上搜索。

1、用MATLAB实现计算器程序源代码function varargout = caculator(varargin) gui_Singleton = 1; gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, caculator_OpeningFcn, . gui_OutputFcn, caculator_OutputFcn, . gui_LayoutFcn, , . gui_Callback, ); if nargin & ischar(varargin1) gui_S

2、tate.gui_Callback = str2func(varargin1); end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:); else gui_mainfcn(gui_State, varargin:); end function caculator_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; set(handles.edit1,string,0); set(handles.edit5,st

3、ring,0); guidata(hObject, handles); function varargout = caculator_OutputFcn(hObject, eventdata, handles) varargout1 = handles.output; function edit1_Callback(hObject, eventdata, handles) function edit1_CreateFcn(hObject, eventdata, handles) if ispc & isequal(get(hObject,BackgroundColor), get(0,defa

4、ultUicontrolBackgroundColor) set(hObject,BackgroundColor,white); end function edit2_Callback(hObject, eventdata, handles) function edit2_CreateFcn(hObject, eventdata, handles) if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white); e

5、nd function edit3_Callback(hObject, eventdata, handles) function edit3_CreateFcn(hObject, eventdata, handles) if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white); end function pushbutton1_Callback(hObject, eventdata, handles) hand

6、les.num1=strcat(get(handles.edit1,string),+); set(handles.edit1,string,handles.num1); guidata(hObject,handles); function pushbutton2_Callback(hObject, eventdata, handles) handles.num2=strcat(get(handles.edit1,string),-); set(handles.edit1,string,handles.num2); guidata(hObject,handles); function push

7、button3_Callback(hObject, eventdata, handles) handles.num3=strcat(get(handles.edit1,string),*); set(handles.edit1,string,handles.num3); guidata(hObject,handles); function pushbutton4_Callback(hObject, eventdata, handles) handles.num4=strcat(get(handles.edit1,string),/); set(handles.edit1,string,hand

8、les.num4); guidata(hObject,handles); function pushbutton_1_Callback(hObject, eventdata, handles) handles.shu1=get(hObject,string); handles.yuanshu=get(handles.edit1,string); if handles.yuanshu(end)=N; handles.yuanshu(end)=; end if handles.yuanshu(1)=0; handles.yuanshu=handles.yuanshu(2:end); end han

9、dles.shu1=strcat(handles.yuanshu,handles.shu1); if length(handles.shu1)=2)&(handles.shu1(end-1)=)& (handles.shu1(1)=l) temp=handles.shu1(end); handles.shu1(end)=handles.shu1(end-1); handles.shu1(end-1)=temp; end set(handles.edit1,string,handles.shu1); guidata(hObject, handles); function pushbutton_2

10、_Callback(hObject, eventdata, handles) handles.shu2=get(hObject,string); handles.yuanshu=get(handles.edit1,string); if handles.yuanshu(end)=N; handles.yuanshu(end)=; end if handles.yuanshu(1)=0; handles.yuanshu=handles.yuanshu(2:end); end handles.shu2=strcat(handles.yuanshu,handles.shu2); if length(

11、handles.shu2)=2)&(handles.shu2(end-1)=)& (handles.shu2(1)=l) temp=handles.shu2(end); handles.shu2(end)=handles.shu2(end-1); handles.shu2(end-1)=temp; end set(handles.edit1,string,handles.shu2); guidata(hObject, handles); function pushbutton_4_Callback(hObject, eventdata, handles) handles.shu4=get(hO

12、bject,string); handles.yuanshu=get(handles.edit1,string); if handles.yuanshu(end)=N; handles.yuanshu(end)=; end if handles.yuanshu(1)=0; handles.yuanshu=handles.yuanshu(2:end); end handles.shu4=strcat(handles.yuanshu,handles.shu4); if length(handles.shu4)=2)&(handles.shu4(end-1)=)& (handles.shu4(1)=

13、l) temp=handles.shu4(end); handles.shu4(end)=handles.shu4(end-1); handles.shu4(end-1)=temp; end set(handles.edit1,string,handles.shu4); guidata(hObject, handles); function pushbutton_3_Callback(hObject, eventdata, handles) handles.shu3=get(hObject,string); handles.yuanshu=get(handles.edit1,string); if handles.yuanshu(end)=N; handles.yuanshu(end)=; end if handles.yuanshu(1)=0; handles.yuanshu=handles.yuanshu(2:end); end handles.shu3=strcat(handles.yuanshu,handles.shu3); if length(handles.shu3)=2)&(handles.shu3(end-1)=)& (handles.shu3(1)=l)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号