资源预览内容
第1页 / 共24页
第2页 / 共24页
第3页 / 共24页
第4页 / 共24页
第5页 / 共24页
第6页 / 共24页
第7页 / 共24页
第8页 / 共24页
第9页 / 共24页
第10页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
MATLAB仿XP系统计算器编程代码和GUI附图function varargout = Caculater(varargin)% CACULATER M-file for Caculater.fig% CACULATER, by itself, creates a new CACULATER or raises the existing% singleton*.% H = CACULATER returns the handle to a new CACULATER or the handle to% the existing singleton*.% CACULATER(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in CACULATER.M with the given input arguments.% CACULATER(Property,Value,.) creates a new CACULATER or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before Caculater_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to Caculater_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help Caculater % Last Modified by GUIDE v2.5 19-Jul-2011 13:59:25 % Begin initialization code - DO NOT EDIT %程序有由于使用num2str函数,是的小数最多为四位,如需更多,可参考num2str(X,N),其中N表示最大容许小数位数 gui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, Caculater_OpeningFcn, . gui_OutputFcn, Caculater_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) 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 Caculater is made visible.function Caculater_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 command line arguments to Caculater (see VARARGIN) % Choose default command line output for Caculaterhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes Caculater wait for user response (see UIRESUME)% uiwait(handles.fig_caculater); set(handles.edit_show,String,0,UserData,0);set(handles.pushbutton_n0,UserData,0);set(handles.pushbutton_n1,UserData,0);set(handles.pushbutton_n2,UserData,0);set(handles.pushbutton_n3,UserData,0);set(handles.pushbutton_plus,UserData,0);set(handles.pushbutton_M,UserData,0);set(handles.pushbutton_MM,Enable,off,String,UserData,0);set(handles.pushbutton_point,UserData,0);set(handles.pushbutton_negate,UserData,0);set(handles.pushbutton_sqrt,UserData,0); % - Outputs from this function are returned to the command line.function varargout = Caculater_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 handles structurevarargout1 = handles.output; % - Executes on button press in pushbutton_MC.function pushbutton_MC_Callback(hObject, eventdata, handles)% hObject handle to pushbutton_MC (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) num=get(handles.pushbutton_MM,UserData,0); if(rem(num,2)=1) set(handles.pushbutton_M,UserData,0); if (get(handles.pushbutton_n2,UserData)=0)&(get(handles.pushbutton_n3,UserData)=0) set(handles.pushbutton_n0,UserData,0); elseif (get(handles.pushbutton_n2,UserData)=1)&(get(handles.pushbutton_n3,UserData)=0) set(handles.pushbutton_n1,UserData,0); end set(handles.edit_show,String,0,UserData,0);end set(handles.pushbutton_point,UserData,0);set(handles.pushbutton_negate,UserData,0);set(handles.pushbutton_sqrt,UserData,0); % - Executes on button press in pushbutton_MR.function pushbutton_MR_Callback(hObject, eventdata, handles)% hObject handle to pushbutton_MR (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) num=get(handles.pushbutton_MM,UserData); if(rem(num,2)=1) num1=get(handles.pushbutton_M,UserData); set(handles.edit_show,String,num2str(num1),UserData,num1); if (get(handles.pushbutton_n2,UserData)=0)&(get(
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号