MATLAB 2008a GUIDE
GUIDE GUIDE Graphic User Interface Design Environment Graphical User Interface GUI GUIDE 令 拉 見 GUIDE 不 GUI GUI 行 率
GUIDE MATLAB 7.x GUIDE 令 guide GUIDE
GUIDE Create New GUI Blank GUI (Default) GUI with Uicontrols UI UI Controls GUI with Axes and Menu 拉 Modal Question Dialog GUI Open Existing GUI 來
GUIDE 了 說 Create New GUI Blank GUI (Default) 來
GUIDE UI 滑 來 UI GUIDE 更 File/Preference Show names in component palette 說 Ruler 拉 Tools/Grid and Rulers Show rulers
GUIDE GUIDE
GUIDE ( 來 ) 兩 拉 Slider 欄 Edit Text
滑 來 UI Inspect Properties 拉 例 滑 Inspect Properties Property Inspector
來 令 令 GUI 列 拉 拉 0 1 欄 欄 拉 GUIDE 令 來 _Callback
滑 拉 View Callbacks/Callback MATLAB 令 拉 Tag myslider myslider_callback() 兩列 position = num2str(get(handles.myslider, 'Value')); set(handles.mytext, 'String', position); 列 拉 數 列 數 欄
GUIDE
欄 令 mytext_callback() 兩列 value = str2double(get(handles.mytext, 'String')); set(handles.myslider, 'Value', value); 列 欄 數 列 拉 數
GUIDE
GUIDE 列 GUI 若不 MATLAB 路
GUI 拉 欄 欄 來 拉
令 不 UI 料 UI 令 來 行 GUIDE 了 數 handles 便 料 列兩 handles 來 料 handles 來 UI
例 若 數 A 列 handles.mydata = A; % 數 A handles mydata 欄 guidata(hobject, handles) % handles GUI 裡 數 A 列 A = handles.mydata;
handles 了 GUI handles.myslider 拉 handles.mytext 欄 GUI mygui handles.mygui GUI 若 列 delete(handles.mygui)
例 不 數 錄 數 GUIDE 拉 File/Save As mygui02 GUIDE mygui02.m mygui02_openingfcn() 列 handles.errorcount = 0; guidata(hobject, handles); handles 留
欄 令 value = str2double(get(handles.mytext, 'String')); % 0 1 量數 if isnumeric(value) & length(value)==1 &... value >= get(handles.myslider, 'Min') &... value <= get(handles.myslider, 'Max') set(handles.myslider, 'Value', value); else % 若不 數 handles.errorcount = handles.errorcount + 1; guidata(hobject, handles); % handles errmsg = [' 不 : ', num2str(handles.errorcount), ' ']; set(handles.mytext, 'String', errmsg); end
行 不 數
例 拉 來 不 來 UI
滑 來 UI Inspect Properties String: chirp handle laughter Tag: soundfile String: Load File String: Close Tag: closebutton String: Play Sound Tag: playbutton
UI 令 MatLab UI 令 滑 Close View Callbacks/Callback 令 例 Close Tag closebutton 令 數 closebutton_callback
令 close(gcbf) GUIDE
gcbf 令 close(gcbf) GUI gcbf 令 類 令 理 gcf: get current figure gca: get current axes gco: get current object gcbf: get callback figure 令 gcbo: get callback object 令
拉 soundfile_callback() value=get(hobject, 'value'); % UI switch value % 來 case 1 load chirp.mat case 2 load handel.mat case 3 load laughter.mat end plot((1:length(y))/fs, y); % handles.y=y; % 錄 handles.fs=fs; % 錄 率 guidata(hobject, handles); % handles
令 說 hobject 拉 value = get(hobject, value ) 不 來 不 chirp.mat handel.mat laughter.mat 料 y 料 Fs 率 兩 數 UI 令 兩 數 handles.y handles.fs 數 handles 不 料 料 handles guidata(hoject, handles) 來更 GUI handles 數
Play Sound playbutton_callback() if isfield(handles, 'y') y=handles.y; Fs=handles.Fs; sound(y, Fs); end isfield(handles, 'y') 來 y 不 handles 若 料 handles 數 y Fs sound(y, Fs) 來
MATLAB GUIDE 列 GUI
若 拉 handel Play Sound 喇
例 拉
View/View Callback/CreateFcn MATLAB *_OpeningFcn() 列 令 peaks; 令 peaks 度 來
Tools/Menu Editor
Label
若 若 行
View MATLAB 令 Shading/faceted Shading/interp Shading/flat Colormap/Gray Colormap/Cool Colormap/Summer 令 shading faceted shading interp shading flat colormap gray colormap cool colormap summer
行 拉 GUI
GUIDE 狀 Object Browsers GUIDE View/Object Browser 來 Object Browsers
若 GUIDE Tools/Align Objects 來 來 行