Anda di halaman 1dari 12
Pada Command Window >>guidee enter einai — x Neat Ses awee| ae aI re eg oa =o ao = tenet ume nt 91 _ Poot 0 ah usatlah desain gui matlahnya seperti dihawa ini co =e x pee skeoc shee Gael > 5] ; ee E R > oa, a ~ =o . ws of ix a . = Y ew Ketar Setelah selesai desain gui kemudian klik tanda panah hijau dan source kode seperti dibawah ini Source code function varargout = HistogramGb (varargin) % HISTOGRAMGS MATLAB code for HistogranGb. fig 4 HISTOGRAMGB, by itself, creates a new HISTOGRAMGB or raises the existing 2 singLeton*. & % H = HISTOGRAMGB returns the handle to a new HISTOGRAMGE or the handle a the existing singleton’ & a MISTOGRANGB ("CALLBACK' , LODject, eveutDala,haudies,...) calls Lie Lucal, $ function named CALLBACK in HISTOGRAMGB.M with the given input arguments. 3 8 HISTOGRAMGB(*Property', 'Value',...} creates a new HISTOGRAMGB or reises the a existing singleton". Starting from the left, property value pairs are 2 applied to the GUI before HistogramGh OpeningFen gets called. An 4 unzecognized property name or invalid value makes property application a stop. All inputs are passed to HistogramGb OpeningFen via varargin. 3 a *See GUI Options on GUIDE'e Toole menu, Chooee "GUI allowe only one a instance to tun (singleton) ". 4 See also: GUIDE, GUIDATA, GUTHANDLES @ BULL Ute above Leal Lo modify Ule response Lo help Histogeansh @ Last Modified by GUIDE v2.5 27-Dec-2018 14:32:24 % Begin initialization code - DO NO? EDIT gui_Singleton = 1; gui_state = struct ("gui Name’, mtilename, ... tgui_Singleton’, gui Singleton, ... ‘guilOpeningfcn', @#istogramGb OpeningFen, ... ‘gui_outputfen', | @HistogramGb_outputFen, ... tgui_tayoutfen’, (Jy eee tguitalipack', J)? if nargin 4& ischar (varargin(1}) gui_State.gui_Callback = str2func(vararain{1}); ena if nargout Ivarargout(1:nargout}| = gui_mainten(gui_State, varargin(:})+ else gui_mainfon(gui_state, varargin end 3 End initialization code - DO NOT EDIT % ~-- Executes just before HistogranGb is made visible. function HistogramGh OpeningFcn (hObject, eventdata, handles, varargin) {This function has ho output args, see OutputFen. hObject handle to figure evellldala reserved ~ Lo be deflued in ¢ Culuce version of MATLAB handles structure with handles and user data (see GUIDATA) varargin command line arguments to Histogramsb (see VARARGIN) & Choose default command line output for Histogramcb nandies.output = nOpject; @ Update handles structure guidata (hObject, handles); movegui (hObject, 'center'); clcsclear; 4 UIWAIT makes HistogranGb wait tor user response (see UIRESUME) & uiwait (handles, figurel); @ =-- Outputs from this function are returned to the command line. function varargout = HistogramGb_OutputFen (hObject, eventdata, handles) & varargout cell array for returning output args (see VARARGOUT) ; % hObject handle to fiqure Beventdata reserved - to be defined in a future version of MATLAB @ handles structure with handles and user data (see GUIDATA) & Get default comand line output from handles structure varargant {1} = handles entpnt @ 22+ Eavcules on buttum press in blubionse. function btnbrowse Callback (hObject, eventdata, handles) @ hObject handle to btnbrowse (see GCRO) } eventdata reserved to be defined in a future version of MATLAD ‘handles structure with handles and user data (see GUIDATA) (filename, pathname] = uigetfile({'*,*')): if ~isegual (filename, 0) Info = imrinto(tulirile (pathname, riiename) ); if Info.BitDepth -- 24 Img = imread(ful1file (pathname, filename) ) ; axes (handles.axes1) cla('reset") imshow (Img) title ('RcD") else msgbox ("Citra masukan harus citra RGB"); return end eles return end i = handles.i handles. Img = Ing; Ui = imzead (full Fite (pathname, filename) ) + guidata (hObject, handles) ;

Anda mungkin juga menyukai