matlab課程設(shè)計(簡單計算器的設(shè)計)_第1頁
matlab課程設(shè)計(簡單計算器的設(shè)計)_第2頁
matlab課程設(shè)計(簡單計算器的設(shè)計)_第3頁
matlab課程設(shè)計(簡單計算器的設(shè)計)_第4頁
matlab課程設(shè)計(簡單計算器的設(shè)計)_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上matlab課程設(shè)計報告題 目簡易計算器的設(shè)計學 院電子信息工程學院專 業(yè)電子信息學生姓名和學號指導教師一 、選題目的及意義 GUI的廣泛應用是當今計算機發(fā)展的重大成就之一,它極大地方便了非專業(yè)用戶的使用。人們從此不再需要死記硬背大量的命令,取而代之的是可以通過窗口、菜單、按鍵等方式來方便地進行操作,而在matlab有很簡單的gui設(shè)計工具,我們可以通過這個工具輕松地構(gòu)建我們想要的程序,從而實現(xiàn)與用戶的信息交互。本次課程設(shè)計是使用了matlab中的guide生成了簡單的計算器程序。 二、源代碼function varargout = Calculator(vararg

2、in) %Simple Calculator%Anhui University % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', Calculator_OpeningFcn, . 'gui_OutputFcn', Calculator_OutputFcn, . 'gu

3、i_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 jus

4、t 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 G

5、UIDATA)% varargin command line arguments to Calculator (see VARARGIN) % Choose default command line output for Calculatorhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes Calculator wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Output

6、s 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 structur

7、e with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = 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 versio

8、n 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

9、 handle to p2 (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,'2');set(handles.text1,'string',textstring) % - Executes o

10、n button press in p3.function p3_Callback(hObject, eventdata, handles)% hObject handle to p3 (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(textst

11、ring,'3');set(handles.text1,'string',textstring) % - Executes on button press in p4.function p4_Callback(hObject, eventdata, handles)% hObject handle to p4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see

12、GUIDATA)textstring=get(handles.text1,'string');textstring=strcat(textstring,'4');set(handles.text1,'string',textstring) % - Executes on button press in p5.function p5_Callback(hObject, eventdata, handles)% hObject handle to p5 (see GCBO)% eventdata reserved - to be defined in

13、 a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textstring=get(handles.text1,'string');textstring=strcat(textstring,'5');set(handles.text1,'string',textstring) % - Executes on button press in p6.function p6_Callback(hObject, eventdata, h

14、andles)% hObject handle to p6 (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,'6');set(handles.text1,'string',textstring

15、) % - Executes on button press in p7.function p7_Callback(hObject, eventdata, handles)% hObject handle to p7 (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');textstri

16、ng=strcat(textstring,'7');set(handles.text1,'string',textstring) % - Executes on button press in p8.function p8_Callback(hObject, eventdata, handles)% hObject handle to p8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and

17、 user data (see GUIDATA)textstring=get(handles.text1,'string');textstring=strcat(textstring,'8');set(handles.text1,'string',textstring) % - Executes on button press in p9.function p9_Callback(hObject, eventdata, handles)% hObject handle to p9 (see GCBO)% eventdata reserved -

18、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,'9');set(handles.text1,'string',textstring) % - Executes on button press in add.function add_Callback(hOb

19、ject, eventdata, handles)% hObject handle to add (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,'+');set(handles.text1,'str

20、ing',textstring) % - Executes on button press in p0.function p0_Callback(hObject, eventdata, handles)% hObject handle to p0 (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,'st

21、ring');textstring=strcat(textstring,'0');set(handles.text1,'string',textstring) % - Executes on button press in sub.function sub_Callback(hObject, eventdata, handles)% hObject handle to sub (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles stru

22、cture with handles and user data (see GUIDATA)textstring=get(handles.text1,'string');textstring=strcat(textstring,'-');set(handles.text1,'string',textstring) % - Executes on button press in div.function div_Callback(hObject, eventdata, handles)% hObject handle to div (see GCB

23、O)% 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,'/');set(handles.text1,'string',textstring) % - Executes on button press in mul.

24、function mul_Callback(hObject, eventdata, handles)% hObject handle to mul (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,'*');s

25、et(handles.text1,'string',textstring) % - Executes on button press in denghao.function denghao_Callback(hObject, eventdata, handles)% hObject handle to denghao (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUID

26、ATA)textstring=get(handles.text1,'string');textstring=eval(textstring);set(handles.text1,'string',textstring) % - Executes on button press in clear.function clear_Callback(hObject, eventdata, handles)% hObject handle to clear (see GCBO)% eventdata reserved - to be defined in a future

27、 version of MATLAB% handles structure with handles and user data (see GUIDATA) set(handles.text1,'string','0') % -function exit_Callback(hObject, eventdata, handles)% hObject handle to exit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close(gcf) % -function

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論