好文档 - 专业文书写作范文服务资料分享网站

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

天下 分享 时间: 加入收藏 我要投稿 点赞

matlab课程设计报告

题 目 学 院 专 业

学生姓名和学号

指导教师

简易计算器的设计 电子信息工程学院

电子信息

1 / 11

一 、选题目的及意义

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', mfilename, ...

'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

2 / 11

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 command line arguments to Calculator (see VARARGIN)

% Choose default command 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 command 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 command 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

3 / 11

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

matlab课程设计报告题目学院专业学生姓名和学号指导教师简易计算器的设计电子信息工程学院电子信息<
推荐度:
点击下载文档文档为doc格式
95n836hecq52amw9ksyh
领取福利

微信扫码领取福利

微信扫码分享