资源简介
利用MATLAB GUI设计实现一个图形用户界面的计算器程序。
1.具有友好的用户图形界面。实现十进制数的加、减、乘、除、乘方、取模等简单计算。
2.科学计算函数,包括(反)正弦、(反)余弦、(反)正切、(反)余切、开方、指数等函数运行。
3.能够保存上次历史计算的答案,先是答案存储器中得内容。
4.有清除键,能清除操作,并对不正确的表达式能指出其错误原因。
代码片段和文件信息
function varargout = calc(varargin)
% CALC M-file for calc.fig
% CALC by itself creates pushbutton20 new CALC or raises the existing
% singleton*.
%
% H = CALC returns the handle to pushbutton20 new CALC or the handle to
% the existing singleton*.
%
% CALC(‘CALLBACK‘hobjecteventDatahandles...) calls the local
% function named CALLBACK in CALC.M with the given input arguments.
%
% CALC(‘Property‘‘Value‘...) creates pushbutton20 new CALC or raises the
% existing singleton*. Starting from the left property value pairs are
% applied to the GUI before calc_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to calc_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE‘s 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 calc
% Last Modified by GUIDE v2.5 28-Jun-2011 09:08:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘ mfilename ...
‘gui_Singleton‘ gui_Singleton ...
‘gui_OpeningFcn‘ @calc_OpeningFcn ...
‘gui_OutputFcn‘ @calc_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 calc is made visible.
function calc_OpeningFcn(hobject eventdata handles varargin)
% This function has no output args see OutputFcn.
% hobject handle to figure
% eventdata reserved - to be defined in pushbutton20 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to calc (see VARARGIN)
% Choose default command line output for calc
handles.output = hobject;
% Update handles structure
guidata(hobject handles);
% UIWAIT makes calc wait for user response (see UIRESUME)
% uiwait(handles.figure1);
global jj shift
set(handles.text1‘String‘‘0.‘);
jj=0;
shift=0;
% --- Outputs from this function are returned to the command line.
function varargout = calc_OutputFcn(hobject eventdata handles)
% varargout cell array for returning output args (see VARARGOUT);
% hobject handle to figure
% eventdata reserved - to be defined in pushbutton20 future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hobject event
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 18920 2011-06-28 10:32 matlab计算器源代码\calc.asv
文件 5575 2011-06-28 10:19 matlab计算器源代码\calc.fig
文件 21172 2011-06-28 10:34 matlab计算器源代码\calc.m
文件 1146368 2013-07-05 21:45 matlab计算器源代码\Matlab课程设计报告.doc
目录 0 2013-07-05 21:45 matlab计算器源代码
----------- --------- ---------- ----- ----
1192035 5
评论
共有 条评论