GUI设计的简易计算器附程序

  • 格式:pdf
  • 大小:195.77 KB
  • 文档页数:18

下载文档原格式

  / 18
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

电子信息工程系实验报告

课程名称:MATLAB 应用

实验项目名称:GUI 计算器设计

实验时间:2012-11-22班级:测控081姓名:学号:810707132实验目的:

1.熟悉MATLAB 的菜单设计方法

2.熟悉MATLAB 的主要控件使用方法

3.熟悉MATLAB 的GUI 设计流程

4.运用MATLAB 的GUI 设计一个简单的计算器

实验环境:

MATLAB7.8

实验内容:

function varargout =jisuanqi1(varargin)%JISUANQI1M-file for jisuanqi1.fig %JISUANQI1,by itself,creates a new JISUANQI1or raises the existing %singleton*.%%H =JISUANQI1returns the handle to a new JISUANQI1or the handle to %the existing singleton*.%%JISUANQI1('CALLBACK',hObject,eventData,handles,...)calls the local %function named CALLBACK in JISUANQI1.M with the given input arguments.%%JISUANQI1('Property','Value',...)creates a new JISUANQI1or raises the %existing singleton*.Starting from the left,property value pairs are %applied to the GUI before jisuanqi1_OpeningFunction gets called.An %unrecognized property name or invalid value makes property application %stop.All inputs are passed to jisuanqi1_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 jisuanqi1

%Last Modified by GUIDE v2.505-Dec-201022:24:59

%Begin initialization code -DO NOT EDIT gui_Singleton =1;成

绩:

指导教师(签名):

'gui_Singleton',gui_Singleton,...

'gui_OpeningFcn',@jisuanqi1_OpeningFcn,...

'gui_OutputFcn',@jisuanqi1_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 jisuanqi1is made visible.

function jisuanqi1_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 jisuanqi1(see VARARGIN)

%以下是本实验初始化部分程序的代码:

global c p t c1f;

f=0;

t=0;

p=2;

c1=num2str(0);

c='0.';

set(handles.edit1,'String',c);

guidata(hObject,handles);

%Choose default command line output for jisuanqi1

handles.output=hObject;

%Update handles structure

guidata(hObject,handles);

%UIWAIT makes jisuanqi1wait for user response(see UIRESUME)

%uiwait(handles.figure1);

%---Outputs from this function are returned to the command line. function varargout=jisuanqi1_OutputFcn(hObject,eventdata,handles)