




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、學(xué)習(xí)本教程的目的: 學(xué)會(huì)用matlab gui設(shè)計(jì)用戶界面,并編寫響應(yīng)程序。一、 GUI基礎(chǔ)知識(shí)圖形用戶界面(Graphical User Interfaces ,GUI )則是由窗口、光標(biāo)、按鍵、菜單、文字說明等對(duì)象(Objects)構(gòu)成的一個(gè)用戶界面。用戶通過一定的方法(如鼠標(biāo)或鍵盤)選擇、激活這些圖形對(duì)象,使計(jì)算機(jī)產(chǎn)生某種動(dòng)作或變化,比如實(shí)現(xiàn)計(jì)算、繪圖等。 Matlab中設(shè)計(jì)圖形用戶界面的方法有兩種:使用可視化的界面環(huán)境和通過編寫程序。本教程主要通過使用可視化的界面環(huán)境來實(shí)現(xiàn)GUI界面的設(shè)計(jì)啟動(dòng)matlab的GUI界面在matlab主界面的菜單欄File中New下的GUI,如圖1所示圖1
2、單擊GUI后會(huì)出現(xiàn)如圖2界面圖2Matlab為GUI設(shè)計(jì)一共準(zhǔn)備了4種模板,分別是:u Blank GUI(Default)(空白模板,默認(rèn));u GUI with Uicontrols(帶控件對(duì)象的GUI模板); u GUI with Axes and Menu(帶坐標(biāo)軸與菜單的GUI模板);u Modal Question Dialog(帶模式問題對(duì)話框的GUI模板)。我們?nèi)腴T時(shí)經(jīng)常會(huì)使用第一個(gè)模板,即Blank GUI(空白模板)。單擊圖2中的ok會(huì)出現(xiàn)下圖界面(圖3)圖3圖形用戶界面GUI設(shè)計(jì)窗口由菜單欄、工具欄、控件工具欄以及圖形對(duì)象設(shè)計(jì)區(qū)等4個(gè)功能區(qū)組成。菜單欄:GUI設(shè)計(jì)窗口的菜
3、單欄有File、Edit、View、Layout、Tools和Help 6個(gè)菜單項(xiàng),使用其中的命令可以完成圖形用戶界面的設(shè)計(jì)操作。工具欄:編輯工具在菜單欄的下方,提供了“編程”時(shí)常用的工具,例如可以進(jìn)行保存、撤銷、運(yùn)行等等操作。控件工具欄:各個(gè)模塊位于窗口的左半部分,提供了設(shè)計(jì)GUI過程中所用的用戶控件;了解各個(gè)模塊(用戶控件)的用途和作用對(duì)GUI的設(shè)計(jì)起到比較大的作用。圖形對(duì)象設(shè)計(jì)區(qū):該區(qū)域是網(wǎng)格形式的用戶設(shè)計(jì)GUI的空白區(qū)域,可以把用戶控件做到區(qū)域里。對(duì)matlab菜單欄中部分內(nèi)容的解釋u 布局編輯器(Layout Edtor)在圖形窗口中創(chuàng)建及布置圖形對(duì)象。布局編輯器是可以啟動(dòng)用戶界面的
4、控制面板,Layout Edtor用于從控件選擇板上選擇控件對(duì)象并放置到布局區(qū)去,布局區(qū)被激活后就成為圖形窗口。 u 菜單編輯器(Menu Editor)創(chuàng)建、設(shè)計(jì)、修改下拉式菜單和快捷菜單;u 對(duì)象瀏覽器(Object Browser)用于獲得當(dāng)前Matlab圖形用戶界面程序中的全部對(duì)象信息,對(duì)象的類型,同時(shí)顯示控件的名稱和標(biāo)識(shí),在控件上雙擊鼠標(biāo)可以打開該控件的屬性編輯器;u 屬性查看器(Property Inspector)查詢并設(shè)置屬性值; 同圖4u Tab順序編輯器(Tab Order Editor)用于設(shè)置當(dāng)用戶按下鍵盤上的Tab鍵時(shí),對(duì)象被選中的先后順序。 u M-文件編輯器(M-
5、file Editor)用于編輯控件對(duì)象的回應(yīng)函數(shù),在該m-文件中編程,既可把各個(gè)控件對(duì)象聯(lián)系在一起,來實(shí)現(xiàn)想要實(shí)現(xiàn)的功能??丶ぞ甙粹o(Push Buttons):執(zhí)行某種預(yù)定的功能或操作(左二)單選框(Radio Button):?jiǎn)蝹€(gè)的單選框用來在兩種狀態(tài)之間切換,多個(gè)單選框組成一個(gè)單選框組時(shí),用戶只能在一組狀態(tài)中選擇單一的狀態(tài),或稱為單選項(xiàng);(左三)文本編輯器(Editable Texts):用來使用鍵盤輸入字符串的值,可以對(duì)編輯框中的內(nèi)容進(jìn)行編輯、刪除和替換等操作;(左四)彈出式菜單(Popup Menus): 讓用戶從一列菜單項(xiàng)中選擇一項(xiàng)作為參數(shù)輸入;(左五)開關(guān)按鈕(Toggle
6、Button):產(chǎn)生一個(gè)動(dòng)作并指示一個(gè)二進(jìn)制狀態(tài)(開或關(guān)),當(dāng)鼠點(diǎn)擊它時(shí)按鈕將下陷,并執(zhí)行callback(回調(diào)函數(shù))中指定的內(nèi)容,再次點(diǎn)擊,按鈕復(fù)原,并再次執(zhí)行callback 中的內(nèi)容;(左六)坐標(biāo)軸(Axes): 用于顯示圖形和圖象。(左七)滾動(dòng)條(Slider): 可輸入指定范圍的數(shù)量值(右一)復(fù)選框(Check Boxes):?jiǎn)蝹€(gè)的復(fù)選框用來在兩種狀態(tài)之間切換,多個(gè)復(fù)選框組成一個(gè)復(fù)選框組時(shí),可使用戶在一組狀態(tài)中作組合式的選擇,或稱為多選項(xiàng);(右二)靜態(tài)文本框(Static Texts): 僅用于顯示單行的說明文字(右三)列表框(List Boxes):在其中定義一系列可供選擇的字符串
7、;(右四)控件對(duì)象的公共屬性 雙擊模塊(控件對(duì)象)就會(huì)進(jìn)入一個(gè)屬性設(shè)置與修改的區(qū)域,如下圖(圖4)所示,通過修改一些參數(shù),就可以改變模塊的外在形式。圖4控件對(duì)象公共屬性:u Children 取值為空矩陣,因?yàn)榭丶?duì)象沒有自己的子對(duì)象;u Parent取值為某個(gè)圖形窗口對(duì)象的句柄,該句柄表明了控件對(duì)象所在的圖形窗口;u Tag取值為字符串,定義了控件的標(biāo)識(shí)值,在任何程序中都可以通過這個(gè)標(biāo)識(shí)值控制該控件對(duì)象;u Type 取值為uicontrol,表明圖形對(duì)象的類型;u UserDate取值為空矩陣,用于保存與該控件對(duì)象相關(guān)的重要數(shù)據(jù)和信息;u Visible取值為on 或off。u Backg
8、roundColor取值為顏色的預(yù)定義字符或RGB數(shù)值;缺省值為淺灰色;u Callback取值為字符串,可以是某個(gè)M文件名或一小段Matlab語句,當(dāng)用戶激活某個(gè)控件對(duì)象時(shí),應(yīng)用程序就運(yùn)行該屬性定義的子程序;u Enable取值為on(缺省值),inactive和off;u Extend取值為四元素矢量0, 0, width, height,記錄控件對(duì)象標(biāo)題字符的位置和尺寸;u ForegroundColor取值為顏色的預(yù)定義字符或RGB數(shù)值,該屬性定義控件對(duì)象標(biāo)題字符的顏色;缺省值為黑色;u Max,Min取值都為數(shù)值,缺省值分別為1和0;u String取值為字符串矩陣或塊數(shù)組,定義控件
9、對(duì)象標(biāo)題或選項(xiàng)內(nèi)容;u Style取值可以是pushbutton(缺省值), radiobutton, checkbox, edit, text, slider, frame, popupmenu 或listbox;u Units取值可以是pixels (缺省值), normalized(相對(duì)單位), inches, centimeters(厘米)或points(磅);u Value取值可以是矢量,也可以是數(shù)值,其含義及解釋依賴于控件對(duì)象的類型。u FontAngle取值為normal(正體,缺省值), italic(斜體), oblique(方頭);u FontName取值為控件標(biāo)題等字體的
10、字庫(kù)名;u FontSize取值為數(shù)值;u FontUnits取值為points(缺省值), normalized, inches, centimeters或pixels;u FontWeight取值為normal(缺省值), light,demi和bold,定義字符的粗細(xì);u HorizontalAligment取值為left,center (缺省值) 或 right,定義控件對(duì)象標(biāo)題等的對(duì)齊方式。u ListboxTop取值為數(shù)量值,用于listbox控件對(duì)象;u SliderStep取值為兩元素矢量minstep,maxstep,用于slider控件對(duì)象;u Selected取值為on
11、或off(缺省值) ;u SlectionHoghlight取值為on 或off(缺省值) 。u BusyAction取值為cancel或queue(缺省值) ;u ButtDownFun取值為字符串,一般為某個(gè)M文件名或一小段Matlab程序;u Creatfun 取值為字符串,一般為某個(gè)M文件名或一小段Matlab程序;u DeletFun取值為字符串,一般為某個(gè)M文件名或一小段Matlab程序;u HandleVisibility取值為on(缺省值), callback或off;u Interruptible取值為on 或off(缺省值) 。設(shè)計(jì)時(shí)用到某個(gè)參數(shù),到這里查找即可講到這里,問
12、大家一個(gè)問題:為什么要在matlab中創(chuàng)建GUI用戶界面?這是一個(gè)很好的問題,簡(jiǎn)單的回答是可能并不需要使用MATLAB來分析數(shù)據(jù),求解問題,繪制結(jié)果的絕大多數(shù)的人,并不會(huì)發(fā)現(xiàn)GUI 工具很有用。 但是,GUI 可以在MATLAB中生成非常有效的工具和應(yīng)用程序,或是建立演示工作的交互式界面。 生成用戶圖形界面的最常見的理由: 編寫一個(gè)需多次反復(fù)使用的實(shí)用函數(shù),菜單、按鈕、文本框作為輸入方法具有意義; 編寫函數(shù)或開發(fā)應(yīng)用程序供別人使用; 創(chuàng)建一個(gè)過程、技術(shù)或分析方法的交互式示例; 認(rèn)為GUI 的簡(jiǎn)潔,性能良好,并且想自己嘗試一下??梢允共欢幊痰娜嗽诳梢暬翱诮缑嫦螺p松地完成某個(gè)特定功能。圖形用戶
13、界面的設(shè)計(jì)原則和一般步驟 1 設(shè)計(jì)原則 由于要求不同,設(shè)計(jì)出來的界面也千差萬別。但是,自從人們開始設(shè)計(jì)圖形界面以后,界面設(shè)計(jì)的評(píng)判標(biāo)準(zhǔn)卻沒有太大的變化。簡(jiǎn)單說來,一個(gè)好的界面應(yīng)遵循以下三個(gè)原則:簡(jiǎn)單性(Simplicity)、一致性(Consistency )及習(xí)常性(Familiarity)。 (1)簡(jiǎn)單性 設(shè)計(jì)界面時(shí),應(yīng)力求簡(jiǎn)潔、直接、清晰地體現(xiàn)出界面的功能和特征。那些可有可無的功能,應(yīng)盡量刪去,以保持界面的整潔。設(shè)計(jì)的圖形界面要直觀,為此應(yīng)多采用圖形,而間量避免數(shù)值。設(shè)計(jì)界面應(yīng)間量減少窗口數(shù)目,力避在不同窗口之間進(jìn)行來回切換。 (2)一致性 所謂一致性有兩層含義:一是讀者自己開發(fā)的界面風(fēng)
14、格要盡量一致;二是新設(shè)計(jì)的界面要與其他已有的界面的風(fēng)格不要截然向左。這是因?yàn)橛脩粼诔醮问褂眯陆缑鏁r(shí),總習(xí)慣于憑借經(jīng)驗(yàn)進(jìn)行試探。比如說,圖形顯示區(qū)常安排在界面的左半邊,而按鍵等控制區(qū)被排在右側(cè)。 (3)習(xí)常性 設(shè)計(jì)界面時(shí),應(yīng)盡量使用人們所熟悉的標(biāo)志與符號(hào)。用戶可能并不了解新界面的具體含義及操作方法,但他完全可以根據(jù)熟悉標(biāo)志作出正確猜測(cè),自學(xué)入門。 (4)其他考慮因素 除了以上對(duì)界面的靜態(tài)要求外,還應(yīng)注意界面的動(dòng)態(tài)性能。如界面對(duì)用戶操作的響應(yīng)要迅速(Immediate) 、連續(xù)(Continous);對(duì)持續(xù)時(shí)間較長(zhǎng)的運(yùn)算,要給出等待時(shí)間提示,并允許用戶中斷運(yùn)算。 2 一般制作步驟 界面制作包括界面
15、設(shè)計(jì)和程序?qū)崿F(xiàn)。具體制作步驟如下: (1)分析界面所要求實(shí)現(xiàn)的主要功能,明確設(shè)計(jì)任務(wù); (2)在稿紙上繪出界面草圖,并站在使用者的角度來審查草圖; (3)按構(gòu)思的草圖,上機(jī)制作靜態(tài)界面,并檢查之; (4)編寫界面動(dòng)態(tài)功能的程序,對(duì)功能進(jìn)行逐項(xiàng)檢查。 基礎(chǔ)知識(shí)講到這里,下面來看一下具體實(shí)例二、具體實(shí)例(一)統(tǒng)計(jì)鼠標(biāo)的單擊次數(shù)1、 按照前面步驟,打開一個(gè)GUI空白界面。2、 在空白頁放入push putton和static text,如下圖所示。3、 雙擊push button,進(jìn)入push putton屬性設(shè)置界面4、 修改Backgroundcolor為淺藍(lán)色,修改color為黃色,修改fon
16、t size的大小為12,修改string為Click,修改Foregroundcolor為藍(lán)色,修改之后如圖所示:5、 同樣雙擊static Text,進(jìn)入其屬性修改界面,修改font size的大小為12,修改Foregroundcolor為紅色,修改后如圖:6、 保存文件到桌面,文件名為c1;保存確定之后,會(huì)進(jìn)入M-file Editor界面,如圖所示該界面是GUI界面中push putton和static text的內(nèi)在程序,在該M-file Editor界面特定位置編程,即可把push putton和static text兩個(gè)模塊聯(lián)系在一起,以實(shí)現(xiàn)所需功能。7、在M-file 編輯器
17、界面,找到函數(shù)function pushbutton1_Callback(hObject, eventdata, handles)在這個(gè)函數(shù)名稱下面寫入如下程序段:persistent c% 定義局部靜態(tài)變量,persistent變量在聲明時(shí)沒有賦值,將被初始化為空矩陣if isempty(c)% 如果c矩陣是空矩陣 c=0;% 給c賦初值為0endc=c+1;%c等于c加1str=sprintf('Total Clicks: %d',c);%把Total Clicks: c(c是一個(gè)變量)這句話保存到str中set(handles.text1,'String'
18、,str);%把str中的內(nèi)容以字符串的形式顯示在text1中如圖所示:7、 保存程序后,在M-file編輯器中單擊運(yùn)行按鈕,或者在GUI界面單擊運(yùn)行按鈕,都會(huì)出現(xiàn)如下界面:在單擊Click按鈕后,total clicks中的次數(shù)會(huì)隨之變化,下圖是單擊6次之后的界面:(二)一個(gè)二維方陣的加法運(yùn)算1、新建一空白GUI界面2、在界面上安裝8個(gè)編輯文本框、4個(gè)靜態(tài)文本框與2個(gè)push putton,如圖所示:3、可以雙擊每個(gè)模塊并設(shè)置其屬性值,修改font size的大小為12,push button1中的string修改為“+”,push button1中的string修改為“=”,并且設(shè)置8個(gè)編
19、輯文本框、4個(gè)靜態(tài)文本框的string為空,設(shè)置4個(gè)靜態(tài)文本框的顏色為紅色,設(shè)置完之后如圖4、保存至桌面,文件名為c2,保存之后跳到m文件編輯界面,如圖:5添加程序。在function pushbutton2_Callback(hObject, eventdata, handles)下編寫如下程序:s1=str2double(get(handles.edit1,'String');%把edit1里面的字符賦給s1s2=str2double(get(handles.edit5,'String');%把edit5里面的字符賦給s2set(handles.text1,
20、'String',s1+s2);%s1和s2求和,并以字符串的形式保存到text1中 s3=str2double(get(handles.edit2,'String');%把edit2里面的字符賦給s3s4=str2double(get(handles.edit6,'String');%把edit6里面的字符賦給s4set(handles.text2,'String',s3+s4);%s3和s4求和,并以字符串的形式保存到text2中s5=str2double(get(handles.edit3,'String')
21、;s6=str2double(get(handles.edit7,'String');set(handles.text3,'String',s5+s6); s7=str2double(get(handles.edit4,'String');s8=str2double(get(handles.edit8,'String');set(handles.text4,'String',s7+s8);%后面兩個(gè)程序與前兩個(gè)類似,這里不再多加解釋;edit1-8為八個(gè)文本編輯器的string名,test1-4為四個(gè)靜態(tài)文本框的s
22、tring名,在各自模塊的公共屬性(雙擊模塊進(jìn)入)中修改,由此可見模塊的屬性和程序是一一對(duì)應(yīng)的關(guān)系6、在m編輯器界面運(yùn)行,或在GUI界面運(yùn)行則會(huì)出現(xiàn)如圖界面:7、在方框中隨便填入矩陣,例如1 1;2 2和1 2;3 4,點(diǎn)一下等于將會(huì)得到兩個(gè)二維矩陣的和。如圖所示:(三)簡(jiǎn)易計(jì)算器的設(shè)計(jì)1、新建一個(gè)GUI空白界面,如圖:2、放置一個(gè)簡(jiǎn)易計(jì)算器所需要的模塊(1個(gè)Static Text和20個(gè)Push Botton),static text用來顯示數(shù)和結(jié)果,20個(gè)Push Botton分別為09、加減乘除點(diǎn)等于、平方、返回、清空、退出。放置模塊并調(diào)整大小后如圖所示:注意,push button這2
23、0個(gè)按鈕最好按順序,從左到右,從上到下,以免順序錯(cuò)亂后,對(duì)后面編程起到壞的影響3、屬性設(shè)置雙擊Static text進(jìn)入屬性設(shè)置界面,修改Backgroundcolor為淡藍(lán)色,F(xiàn)ontsize為15,string為空白,如圖所示分別雙擊20個(gè)Push Button進(jìn)入按鈕屬性設(shè)置, 分別修改Backgroundcolor為紅色,F(xiàn)ontsize為15,F(xiàn)oregroundColor為黃色,string分別為09、+、-、*、/、.、=、X2、返回、清空、退出等,修改完如圖所示:4、保存文件,文件名c3;保存確認(rèn)后進(jìn)入m文件編輯器,如圖:5、在m文件編輯器里面編寫程序09數(shù)字鍵的編寫09這十個(gè)
24、數(shù)字分別對(duì)應(yīng)string里的button1-button10在function pushbutton1_Callback(hObject, eventdata, handles)下編寫:textString = get(handles.text1,'String');%把text1中的字符串賦給textstring變量textString =strcat(textString,'0');%把textstring中的字符與0連接起來并賦給textstring本身set(handles.text1,'String',textString)%把新的te
25、xtstring中的內(nèi)容以字符串的形式顯示在text1中同理,分別在function pushbutton2-10_Callback(hObject, eventdata, handles)下給1-9數(shù)字按鍵下以相同的方法編寫類似程序符號(hào)鍵的編寫在function pushbutton11_Callback(hObject, eventdata, handles)下編寫:textString = get(handles.text1,'String'); %把text1中的字符串賦給textstring變量textString =strcat(textString,'+&
26、#39;); %把textstring中的字符與+連接起來并賦給textstring本身set(handles.text1,'String',textString)%把新的textstring中的內(nèi)容以字符串的形式顯示在text1中同理,分別在function pushbutton12-15_Callback(hObject, eventdata, handles)和function pushbutton17_Callback(hObject, eventdata, handles)下給符號(hào)鍵-、*、/ 、.、X2 賦值類似語句“=”的編程:(=對(duì)應(yīng)pushbutton16)在
27、function pushbutton16_Callback(hObject, eventdata, handles)下編寫:textString = get(handles.text1,'String');%把text1中的字符串賦給textstring變量ans =eval(textString);%將textString的內(nèi)容轉(zhuǎn)換成數(shù)值表達(dá)式set(handles.text1,'String',ans)%把新的ans中的內(nèi)容以字符串的形式顯示在text1中按鍵“返回”的編程:即刪除一個(gè)空字符:在function pushbutton18_Callback(
28、hObject, eventdata, handles)下編寫:textString=get(handles.text1,'String') %把text1中的字符串賦給textstring變量w=length(textString)%w為textstring的長(zhǎng)度t=char(textString)textString=t(1:w-1)%把t中前w-1個(gè)數(shù)賦給textstringset(handles.text1,'String',textString)清除鍵的程序在function pushbutton19_Callback(hObject, eventda
29、ta, handles)下編寫:set(handles.text1,'String','')%把text清空返回鍵的程序在function pushbutton20_Callback(hObject, eventdata, handles)下編寫:close(gcf);%關(guān)閉句柄值,即關(guān)閉界面6、保存m文件后運(yùn)行,運(yùn)行結(jié)果如下圖:8、 在計(jì)算器界面作如下計(jì)算:輸出結(jié)果為(單擊=):M文件源程序:function varargout = c3(varargin)% C3 M-file for c3.fig% C3, by itself, creates a new
30、 C3 or raises the existing% singleton*.% H = C3 returns the handle to a new C3 or the handle to% the existing singleton*.% C3('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in C3.M with the given input arguments.% C3('Property','Value',.) cre
31、ates a new C3 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before c3_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to c3_OpeningFcn via varargin.% *See GUI Op
32、tions 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 c3 % Last Modified by GUIDE v2.5 02-Jan-2013 17:13:36 % Begin initialization code - DO NOT EDITgui_Singleto
33、n = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', c3_OpeningFcn, . 'gui_OutputFcn', c3_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback
34、 = 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 c3 is made visible.function c3_OpeningFcn(hObject, eventdata, handles, varargin)% This function has
35、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 c3 (see VARARGIN) % Choose default command line output for c3handles.output = hOb
36、ject; % Update handles structureguidata(hObject, handles); % UIWAIT makes c3 wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = c3_OutputFcn(hObject, eventdata, handles) % varargout cell array for retur
37、ning 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
38、in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (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
39、 =strcat(textString,'0');set(handles.text1,'String',textString) % - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles
40、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 pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject
41、 handle to pushbutton3 (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) %
42、- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (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,&
43、#39;String');textString =strcat(textString,'3');set(handles.text1,'String',textString) % - Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future
44、version of MATLAB% handles structure with handles and user data (see GUIDATA)textString = get(handles.text1,'String');textString =strcat(textString,'4');set(handles.text1,'String',textString) % - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, e
45、ventdata, handles)% hObject handle to pushbutton6 (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,'5');set(handles.text1,'
46、;String',textString) % - Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)textS
47、tring = get(handles.text1,'String');textString =strcat(textString,'6');set(handles.text1,'String',textString) % - Executes on button press in pushbutton8.function pushbutton8_Callback(hObject, eventdata, handles)% hObject handle to pushbutton8 (see GCBO)% eventdata reserved -
48、 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,'7');set(handles.text1,'String',textString) % - Executes on button press in pushbutton9.function push
49、button9_Callback(hObject, eventdata, handles)% hObject handle to pushbutton9 (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,'8
50、39;);set(handles.text1,'String',textString) % - Executes on button press in pushbutton10.function pushbutton10_Callback(hObject, eventdata, handles)% hObject handle to pushbutton10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles an
51、d user data (see GUIDATA)textString = get(handles.text1,'String');textString =strcat(textString,'9');set(handles.text1,'String',textString) % - Executes on button press in pushbutton11.function pushbutton11_Callback(hObject, eventdata, handles)% hObject handle to pushbutton11
52、 (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,'String',textString) % - Executes on button p
53、ress in pushbutton12.function pushbutton12_Callback(hObject, eventdata, handles)% hObject handle to pushbutton12 (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');te
54、xtString =strcat(textString,'-');set(handles.text1,'String',textString) % - Executes on button press in pushbutton13.function pushbutton13_Callback(hObject, eventdata, handles)% hObject handle to pushbutton13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLA
55、B% 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 pushbutton14.function pushbutton14_Callback(hObject, eventdata, hand
56、les)% hObject handle to pushbutton14 (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,'String',
57、textString) % - Executes on button press in pushbutton15.function pushbutton15_Callback(hObject, eventdata, handles)% hObject handle to pushbutton15 (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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年導(dǎo)電銀漿合作協(xié)議書
- 營(yíng)銷推廣戰(zhàn)略合作協(xié)議細(xì)節(jié)規(guī)定
- 商務(wù)酒店客房預(yù)訂管理協(xié)議
- 2025年廣西2024危險(xiǎn)品從業(yè)資格考試
- 2025年鋼材:一級(jí)鋼項(xiàng)目發(fā)展計(jì)劃
- 公司職員職務(wù)晉升證明(6篇)
- 專業(yè)演出票務(wù)銷售網(wǎng)絡(luò)協(xié)議
- 電商倉(cāng)儲(chǔ)管理系統(tǒng)開發(fā)合同
- 2025年移動(dòng)通信用智能天線項(xiàng)目發(fā)展計(jì)劃
- 跨文化交際培訓(xùn)方案實(shí)施指南
- 2024年熔化焊接與熱切理論考試1000題及答案
- 弱電機(jī)房設(shè)備與系統(tǒng)巡檢記錄表全套
- 工商管理論文8000字【9篇】
- 全自動(dòng)進(jìn)銷存電子表格系統(tǒng)模板53
- MOOC 豬生產(chǎn)學(xué)-南京農(nóng)業(yè)大學(xué) 中國(guó)大學(xué)慕課答案
- 內(nèi)蒙古呼和浩特市2024屆小升初考試語文試卷含答案
- 貴陽市普通住宅小區(qū)物業(yè)管理服務(wù)收費(fèi)參考標(biāo)準(zhǔn)
- MOOC 地學(xué)景觀探秘·審美·文化-重慶大學(xué) 中國(guó)大學(xué)慕課答案
- 丁苯橡膠工藝流程
- (高清版)WST 311-2023 醫(yī)院隔離技術(shù)標(biāo)準(zhǔn)
- 2024年電梯安裝與維修工理論考試題庫(kù)及答案(通用版)
評(píng)論
0/150
提交評(píng)論