LAMPIRAN
LISTING
PROGRAM
Beranda.m
function varargout = Beranda(varargin) % BERANDA M-file for Beranda.fig
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Beranda_OpeningFcn, ... 'gui_OutputFcn', @Beranda_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
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before Beranda is made visible.
function Beranda_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
handles.citra=imread('logousu.jpg'); guidata(hObject,handles);
axes(handles.axes1); imshow(handles.citra);
% Choose default command line output for Beranda handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes Beranda wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = Beranda_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure varargout{1} = handles.output;
% ---function beranda_Callback(hObject, eventdata, handles)
Beranda
delete(handles.figure1)
% ---function menupelatihan_Callback(hObject, eventdata, handles)
% ---function menupengujian_Callback(hObject, eventdata, handles)
% ---function bantuan_Callback(hObject, eventdata, handles)
Bantuan
% ---function keluar_Callback(hObject, eventdata, handles)
choice= questdlg ('Apakah Anda Ingin Keluar?','Konfirmasi',... 'Ya','Tidak','Tidak');
switch choice case 'Ya' close all; end
% ---function ujibam_Callback(hObject, eventdata, handles)
UjiBAM
delete(handles.figure1)
% ---function ujilvq_Callback(hObject, eventdata, handles)
UjiLVQ
delete(handles.figure1)
% --- function latihbam_Callback(hObject, eventdata, handles)
LatihBAM
delete(handles.figure1)
% ---function latihlvq_Callback(hObject, eventdata, handles)
LatihLVQ
delete(handles.figure1)
LatihBAM.m
function varargout = LatihBAM(varargin) % LATIHBAM M-file for LatihBAM.fig gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @LatihBAM_OpeningFcn, ... 'gui_OutputFcn', @LatihBAM_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
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before LatihBAM is made visible.
function LatihBAM_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% --- Executes on button press in Kel.
function Kel_Callback(hObject, eventdata, handles)
% --- Executes on button press in Keh.
% --- Executes on button press in Sak.
function Sak_Callback(hObject, eventdata, handles)
% --- Executes on button press in tombollatih.
function tombollatih_Callback(hObject, eventdata, handles) tStart = tic; %untuk waktu
%1x16
target1 = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]; target2 = [-1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1]; target3 = [-1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1]; target4 = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1];
input1 = xlsread('bam.xlsx', 'nilai', 'B1:U1'); %1x20 input2 = xlsread('bam.xlsx', 'nilai', 'B2:U2');
input3 = xlsread('bam.xlsx', 'nilai', 'B3:U3'); input4 = xlsread('bam.xlsx', 'nilai', 'B4:U4');
input5 = xlsread('bam.xlsx', 'nilai', 'B5:U5'); %1x20 input6 = xlsread('bam.xlsx', 'nilai', 'B6:U6');
input7 = xlsread('bam.xlsx', 'nilai', 'B7:U7'); input8 = xlsread('bam.xlsx', 'nilai', 'B8:U8');
input9 = xlsread('bam.xlsx', 'nilai', 'B9:U9'); %1x20 input10 = xlsread('bam.xlsx', 'nilai', 'B10:U10'); input11 = xlsread('bam.xlsx', 'nilai', 'B11:U11'); input12 = xlsread('bam.xlsx', 'nilai', 'B12:U12');
input13 = xlsread('bam.xlsx', 'nilai', 'B13:U13'); %1x20 input14 = xlsread('bam.xlsx', 'nilai', 'B14:U14');
input15 = xlsread('bam.xlsx', 'nilai', 'B15:U15'); input16 = xlsread('bam.xlsx', 'nilai', 'B16:U16');
input17 = xlsread('bam.xlsx', 'nilai', 'B17:U17'); %1x20 input18 = xlsread('bam.xlsx', 'nilai', 'B18:U18');
input19 = xlsread('bam.xlsx', 'nilai', 'B19:U19'); input20 = xlsread('bam.xlsx', 'nilai', 'B20:U20');
w1 = input1'* target1; %20x16 w2 = input2'* target1;
w3 = input3'* target1; w4 = input4'* target1; w5 = input5'* target1; w6 = input6'* target2; w7 = input7'* target2; w8 = input8'* target2; w9 = input9'* target2; w10 = input10'* target2; w11 = input11'* target3; w12 = input12'* target3; w13 = input13'* target3; w14 = input14'* target3; w15 = input15'* target3; w16 = input16'* target4; w17 = input17'* target4; w18 = input18'* target4; w19 = input19'* target4; w20 = input20'* target4;
%20x16
xlswrite('bam.xlsx',w, 'bobot', 'A1:P20');
y_in1 = input1 * w; %1x16 y_in2 = input2 * w;
y_in3 = input3 * w; y_in4 = input4 * w; y_in5 = input5 * w; y_in6 = input6 * w; y_in7 = input7 * w; y_in8 = input8 * w; y_in9 = input9 * w; y_in10 = input10 * w; y_in11 = input11 * w; y_in12 = input12 * w; y_in13 = input13 * w; y_in14 = input14 * w; y_in15 = input15 * w; y_in16 = input16 * w; y_in17 = input17 * w; y_in18 = input18 * w; y_in19 = input19 * w; y_in20 = input20 * w;
for indeks = 1 : 5
if (y_in1(indeks) < 0) y_in1(indeks) = -1; else
y_in1(indeks) = 1; end
if (y_in2(indeks) < 0) y_in2(indeks) = -1; else
y_in2(indeks) = 1; end
if (y_in3(indeks) < 0) y_in3(indeks) = -1; else
y_in3(indeks) = 1; end
if (y_in4(indeks) < 0) y_in4(indeks) = -1; else
y_in4(indeks) = 1; end
if (y_in5(indeks) < 0) y_in5(indeks) = -1; else
y_in5(indeks) = 1; end
if (y_in6(indeks) < 0) y_in6(indeks) = -1; else
if (y_in7(indeks) < 0) y_in7(indeks) = -1; else
y_in7(indeks) = 1; end
if (y_in8(indeks) < 0) y_in8(indeks) = -1; else
y_in8(indeks) = 1; end
if (y_in9(indeks) < 0) y_in9(indeks) = -1; else
y_in9(indeks) = 1; end
if (y_in10(indeks) < 0) y_in10(indeks) = -1; else
y_in10(indeks) = 1; end
if (y_in11(indeks) < 0) y_in11(indeks) = -1; else
y_in11(indeks) = 1; end
if (y_in12(indeks) < 0) y_in12(indeks) = -1; else
y_in12(indeks) = 1; end
if (y_in13(indeks) < 0) y_in13(indeks) = -1; else
y_in13(indeks) = 1; end
if (y_in14(indeks) < 0) y_in14(indeks) = -1; else
y_in14(indeks) = 1; end
if (y_in15(indeks) < 0) y_in15(indeks) = -1; else
y_in15(indeks) = 1; end
y_in16(indeks) = 1; end
if (y_in17(indeks) < 0) y_in17(indeks) = -1; else
y_in17(indeks) = 1; end
if (y_in18(indeks) < 0) y_in18(indeks) = -1; else
y_in18(indeks) = 1; end
if (y_in19(indeks) < 0) y_in19(indeks) = -1; else
y_in19(indeks) = 1; end
if (y_in20(indeks) < 0) y_in20(indeks) = -1; else
y_in20(indeks) = 1; end
end
waktupengujian = toc(tStart);
set(handles.waktulatih,'string',waktupengujian); h = msgbox('Data telah dilatih', 'Berhasil');
function namapenyakit_Callback(hObject, eventdata, handles)
function namapenyakit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function waktulatih_Callback(hObject, eventdata, handles)
function waktulatih_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in tombolsimpan.
function tombolsimpan_Callback(hObject, eventdata, handles) a = get(handles.Sul,'Value');
b = get(handles.Per,'Value'); c = get(handles.Bat,'Value'); d = get(handles.Mua,'Value'); e = get(handles.Sua,'Value');
g = get(handles.Mun,'Value'); h = get(handles.Ada,'Value'); i = get(handles.Lam,'Value'); j = get(handles.Atp,'Value');
k = get(handles.Sen,'Value'); l = get(handles.Kem,'Value'); m = get(handles.Ane,'Value'); n = get(handles.Ras,'Value'); o = get(handles.Pen,'Value');
p = get(handles.Tm,'Value'); q = get(handles.Md,'Value'); r = get(handles.Kel,'Value'); s = get(handles.Keh,'Value'); t = get(handles.Sak,'Value');
penyakit= [a b c d e f g h i j k l m n o p q r s t];
for indeks = 1 : 20
if (penyakit(indeks) == 0) penyakit(indeks) = -1; else
penyakit(indeks) = 1; end
end
nm = get(handles.namapenyakit,'String');
if (strcmp(nm , 'Radang Kerongkongan 1'))
xlswrite('bam.xlsx',penyakit,'Nilai','B1:U1'); elseif (strcmp(nm , 'Radang Kerongkongan 2')) xlswrite('bam.xlsx',penyakit,'Nilai','B2:U2'); elseif (strcmp(nm , 'Radang Kerongkongan 3')) xlswrite('bam.xlsx',penyakit,'Nilai','B3:U3'); elseif (strcmp(nm , 'Radang Kerongkongan 4')) xlswrite('bam.xlsx',penyakit,'Nilai','B4:U4'); elseif (strcmp(nm , 'Radang Kerongkongan 5')) xlswrite('bam.xlsx',penyakit,'Nilai','B5:U5');
elseif (strcmp(nm , 'Radang Lambung 1'))
xlswrite('bam.xlsx',penyakit,'Nilai','B6:U6'); elseif (strcmp(nm , 'Radang Lambung 2'))
xlswrite('bam.xlsx',penyakit,'Nilai','B7:U7'); elseif (strcmp(nm , 'Radang Lambung 3'))
xlswrite('bam.xlsx',penyakit,'Nilai','B8:U8'); elseif (strcmp(nm , 'Radang Lambung 4'))
xlswrite('bam.xlsx',penyakit,'Nilai','B9:U9'); elseif (strcmp(nm , 'Radang Lambung 5'))
xlswrite('bam.xlsx',penyakit,'Nilai','B10:U10');
elseif (strcmp(nm , 'Tukak Lambung 1'))
xlswrite('bam.xlsx',penyakit,'Nilai','B11:U11'); elseif (strcmp(nm , 'Tukak Lambung 2'))
xlswrite('bam.xlsx',penyakit,'Nilai','B12:U12'); elseif (strcmp(nm , 'Tukak Lambung 3'))
xlswrite('bam.xlsx',penyakit,'Nilai','B14:U14'); elseif (strcmp(nm , 'Tukak Lambung 5'))
xlswrite('bam.xlsx',penyakit,'Nilai','B15:U15');
elseif (strcmp(nm , 'Kanker Lambung 1'))
xlswrite('bam.xlsx',penyakit,'Nilai','B16:U16'); elseif (strcmp(nm , 'Kanker Lambung 2'))
xlswrite('bam.xlsx',penyakit,'Nilai','B17:U17'); elseif (strcmp(nm , 'Kanker Lambung 3'))
xlswrite('bam.xlsx',penyakit,'Nilai','B18:U18'); elseif (strcmp(nm , 'Kanker Lambung 4'))
xlswrite('bam.xlsx',penyakit,'Nilai','B19:U19'); elseif (strcmp(nm , 'Kanker Lambung 5'))
xlswrite('bam.xlsx',penyakit,'Nilai','B20:U20'); end
penyakit = [];
pesan = msgbox('Data telah disimpan', 'Berhasil');
% --- Executes on button press in tombolreset.
function tombolreset_Callback(hObject, eventdata, handles) set(handles.namapenyakit,'String','','Enable','on');
set(handles.waktulatih,'String','','Enable','on'); set(handles.Sul,'Value',0);
set(handles.Per,'Value',0); set(handles.Bat,'Value',0); set(handles.Mua,'Value',0); set(handles.Sua,'Value',0); set(handles.Nye,'Value',0); set(handles.Mun,'Value',0); set(handles.Ada,'Value',0); set(handles.Lam,'Value',0); set(handles.Atp,'Value',0); set(handles.Sen,'Value',0); set(handles.Kem,'Value',0); set(handles.Ane,'Value',0); set(handles.Ras,'Value',0); set(handles.Pen,'Value',0); set(handles.Tm,'Value',0); set(handles.Md,'Value',0); set(handles.Kel,'Value',0); set(handles.Keh,'Value',0); set(handles.Sak,'Value',0);
% ---function beranda_Callback(hObject, eventdata, handles)
Beranda
delete(handles.figure1)
% ---function menubam_Callback(hObject, eventdata, handles)
% ---function menulvq_Callback(hObject, eventdata, handles)
% ---function bantuan_Callback(hObject, eventdata, handles)
UjiBAM.m
function varargout = UjiBAM(varargin) % UJIBAM M-file for UjiBAM.fig
gui_Singleton = 1;
'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @UjiBAM_OpeningFcn, ... 'gui_OutputFcn', @UjiBAM_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
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before UjiBAM is made visible.
function UjiBAM_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% --- Outputs from this function are returned to the command line. function varargout = UjiBAM_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output;
% --- Executes on button press in tombolreset.
function tombolreset_Callback(hObject, eventdata, handles) xlswrite('databam.xlsx', '0','nilai','B2:U2');
set(handles.namapenyakit,'String','','Enable','on'); set(handles.jenisobat,'String','','Enable','on'); set(handles.waktuuji,'String','','Enable','on'); set(handles.Sul,'Value',0);
set(handles.Per,'Value',0); set(handles.Bat,'Value',0); set(handles.Mua,'Value',0); set(handles.Sua,'Value',0); set(handles.Nye,'Value',0); set(handles.Mun,'Value',0); set(handles.Ada,'Value',0); set(handles.Lam,'Value',0); set(handles.Atp,'Value',0); set(handles.Sen,'Value',0); set(handles.Kem,'Value',0); set(handles.Ane,'Value',0); set(handles.Ras,'Value',0); set(handles.Pen,'Value',0); set(handles.Tm,'Value',0); set(handles.Md,'Value',0); set(handles.Kel,'Value',0); set(handles.Keh,'Value',0); set(handles.Sak,'Value',0);
% --- Executes on button press in tombolhasil.
function tombolhasil_Callback(hObject, eventdata, handles) tStart=tic;
c = get(handles.Bat,'Value'); d = get(handles.Mua,'Value'); e = get(handles.Sua,'Value');
f = get(handles.Nye,'Value'); g = get(handles.Mun,'Value'); h = get(handles.Ada,'Value'); i = get(handles.Lam,'Value'); j = get(handles.Atp,'Value');
k = get(handles.Sen,'Value'); l = get(handles.Kem,'Value'); m = get(handles.Ane,'Value'); n = get(handles.Ras,'Value'); o = get(handles.Pen,'Value');
p = get(handles.Tm,'Value'); q = get(handles.Md,'Value'); r = get(handles.Kel,'Value'); s = get(handles.Keh,'Value'); t = get(handles.Sak,'Value');
data_uji = [a b c d e f g h i j k l m n o p q r s t];
for indeks = 1 : 20
if (data_uji(indeks) == 0) data_uji(indeks) = -1; else
data_uji(indeks) = 1; end
end
w = xlsread('bam.xlsx','bobot','A1:P20'); %20x16 output_uji = data_uji * w; %1x16
for indeks = 1 : 16
if (output_uji(indeks) < 0) output_uji(indeks) = -1; else
output_uji(indeks) = 1; end
end
output_uji
target1 = [1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]; target2 = [-1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1]; target3 = [-1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1]; target4 = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1];
if isequal (output_uji,target1)
set(handles.namapenyakit,'String','Radang Kerongkongan (reflux oesophagitis)');
set(handles.jenisobat,'String','Ranitidin , Omeprazole , Domperidone , Antasida , Sukralfat');
elseif isequal (output_uji,target2)
set(handles.jenisobat,'String','Omeprazole , Antasida , Bismuth , Amoxixilin , Claritromixin)');
elseif isequal (output_uji,target3)
set(handles.namapenyakit,'String','Tukak Lambung-Usus (ulcus pepticum)');
set(handles.jenisobat,'String','Antasida , Bismuth , Sukralfat , Ranitidin , Omeprazole');
elseif isequal (output_uji,target4)
set(handles.namapenyakit,'String','Kanker Lambung');
set(handles.jenisobat,'String','Kemoterapi , Radiasi , Operasi'); else
set(handles.namapenyakit,'String','Tidak Dikenali'); end
waktupengujian = toc(tStart);
set(handles.waktuuji,'string',waktupengujian);
% --- Executes on button press in Sul.
function Sul_Callback(hObject, eventdata, handles)
% --- Executes on button press in Per.
function Per_Callback(hObject, eventdata, handles)
% --- Executes on button press in Bat.
function Bat_Callback(hObject, eventdata, handles)
% --- Executes on button press in Mua.
function Mua_Callback(hObject, eventdata, handles)
% --- Executes on button press in Sua.
function Sua_Callback(hObject, eventdata, handles)
% --- Executes on button press in Nye.
function Nye_Callback(hObject, eventdata, handles)
% --- Executes on button press in Mun.
function Mun_Callback(hObject, eventdata, handles)
% --- Executes on button press in Ada.
function Ada_Callback(hObject, eventdata, handles)
% --- Executes on button press in Lam.
function Lam_Callback(hObject, eventdata, handles)
% --- Executes on button press in Atp.
function Atp_Callback(hObject, eventdata, handles)
% --- Executes on button press in Sen.
function Sen_Callback(hObject, eventdata, handles)
% --- Executes on button press in Kem.
LatihLVQ.m
function varargout = LatihLVQ(varargin) % LATIHLVQ M-file for LatihLVQ.fig gui_Singleton = 1;
'gui_OpeningFcn', @LatihLVQ_OpeningFcn, ... 'gui_OutputFcn', @LatihLVQ_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
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes on button press in Sak.
function Sak_Callback(hObject, eventdata, handles)
% --- Executes on button press in tombolreset.
function tombolreset_Callback(hObject, eventdata, handles) xlswrite('datalvq.xlsx', '0','nilai','B2:U2');
set(handles.namapenyakit,'String','','Enable','on'); set(handles.waktu,'String','','Enable','on');
set(handles.Sul,'Value',0); set(handles.Per,'Value',0); set(handles.Bat,'Value',0); set(handles.Mua,'Value',0); set(handles.Sua,'Value',0); set(handles.Nye,'Value',0); set(handles.Mun,'Value',0); set(handles.Ada,'Value',0); set(handles.Lam,'Value',0); set(handles.Atp,'Value',0); set(handles.Sen,'Value',0); set(handles.Kem,'Value',0); set(handles.Ane,'Value',0); set(handles.Ras,'Value',0); set(handles.Pen,'Value',0); set(handles.Tm,'Value',0); set(handles.Md,'Value',0); set(handles.Kel,'Value',0); set(handles.Keh,'Value',0); set(handles.Sak,'Value',0);
function namapenyakit_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties. function namapenyakit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in tombolsimpan.
function tombolsimpan_Callback(hObject, eventdata, handles) a = get(handles.Sul,'Value');
d = get(handles.Mua,'Value'); e = get(handles.Sua,'Value');
f = get(handles.Nye,'Value'); g = get(handles.Mun,'Value'); h = get(handles.Ada,'Value'); i = get(handles.Lam,'Value'); j = get(handles.Atp,'Value');
k = get(handles.Sen,'Value'); l = get(handles.Kem,'Value'); m = get(handles.Ane,'Value'); n = get(handles.Ras,'Value'); o = get(handles.Pen,'Value');
p = get(handles.Tm,'Value'); q = get(handles.Md,'Value'); r = get(handles.Kel,'Value'); s = get(handles.Keh,'Value'); t = get(handles.Sak,'Value');
penyakit= [a b c d e f g h i j k l m n o p q r s t];
for indeks = 1 : 20
if (penyakit(indeks) == 0) penyakit(indeks) = -1; else
penyakit(indeks) = 1; end
end
nm = get(handles.namapenyakit,'String');
if (strcmp(nm , 'Radang Kerongkongan 1'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B1:U1'); elseif (strcmp(nm , 'Radang Kerongkongan 2')) xlswrite('lvq.xlsx',penyakit,'Nilai','B2:U2'); elseif (strcmp(nm , 'Radang Kerongkongan 3')) xlswrite('lvq.xlsx',penyakit,'Nilai','B3:U3'); elseif (strcmp(nm , 'Radang Kerongkongan 4')) xlswrite('lvq.xlsx',penyakit,'Nilai','B4:U4'); elseif (strcmp(nm , 'Radang Kerongkongan 5')) xlswrite('lvq.xlsx',penyakit,'Nilai','B5:U5');
elseif (strcmp(nm , 'Radang Lambung 1'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B6:U6'); elseif (strcmp(nm , 'Radang Lambung 2'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B7:U7'); elseif (strcmp(nm , 'Radang Lambung 3'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B8:U8'); elseif (strcmp(nm , 'Radang Lambung 4'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B9:U9'); elseif (strcmp(nm , 'Radang Lambung 5'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B10:U10');
elseif (strcmp(nm , 'Tukak Lambung 1'))
elseif (strcmp(nm , 'Tukak Lambung 2'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B12:U12'); elseif (strcmp(nm , 'Tukak Lambung 3'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B13:U13'); elseif (strcmp(nm , 'Tukak Lambung 4'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B14:U14'); elseif (strcmp(nm , 'Tukak Lambung 5'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B15:U15');
elseif (strcmp(nm , 'Kanker Lambung 1'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B16:U16'); elseif (strcmp(nm , 'Kanker Lambung 2'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B17:U17'); elseif (strcmp(nm , 'Kanker Lambung 3'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B18:U18'); elseif (strcmp(nm , 'Kanker Lambung 4'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B19:U19'); elseif (strcmp(nm , 'Kanker Lambung 5'))
xlswrite('lvq.xlsx',penyakit,'Nilai','B20:U20'); end
penyakit = [];
pesan = msgbox('Data telah disimpan', 'Berhasil');
function waktu_Callback(hObject, eventdata, handles)
% hObject handle to waktu (see GCBO)
% --- Executes during object creation, after setting all properties. function waktu_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in tombollatih.
function tombollatih_Callback(hObject, eventdata, handles) tStart = tic; %untuk waktu
%target 1 x 20
w1_awal = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1]; %kelas 1
w2_awal = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1]; %kelas 2
w3_awal = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1]; %kelas 3
w4_awal = [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1]; %kelas 4
input1 = xlsread('lvq.xlsx', 'nilai', 'B1:U1'); %1x20 input2 = xlsread('lvq.xlsx', 'nilai', 'B2:U2');
input3 = xlsread('lvq.xlsx', 'nilai', 'B3:U3'); input4 = xlsread('lvq.xlsx', 'nilai', 'B4:U4');
input5 = xlsread('lvq.xlsx', 'nilai', 'B5:U5'); %1x20 input6 = xlsread('lvq.xlsx', 'nilai', 'B6:U6');
input7 = xlsread('lvq.xlsx', 'nilai', 'B7:U7'); input8 = xlsread('lvq.xlsx', 'nilai', 'B8:U8');
input13 = xlsread('lvq.xlsx', 'nilai', 'B13:U13'); %1x20 input14 = xlsread('lvq.xlsx', 'nilai', 'B14:U14');
input15 = xlsread('lvq.xlsx', 'nilai', 'B15:U15'); input16 = xlsread('lvq.xlsx', 'nilai', 'B16:U16');
input17 = xlsread('lvq.xlsx', 'nilai', 'B17:U17'); %1x20 input18 = xlsread('lvq.xlsx', 'nilai', 'B18:U18');
input19 = xlsread('lvq.xlsx', 'nilai', 'B19:U19'); input20 = xlsread('lvq.xlsx', 'nilai', 'B20:U20');
pola = [input1 ; input2 ; input3 ; input4; input5 ; input6 ; input7 ; input8 ; input9 ; input10; input11; input12; input13 ; input14 ; input15 ; input16 ; input17; input18; input19; input20]; kelas = [1 ; 2 ; 3 ; 4];
a = 0.05;
max_epoch = 100000;
epoch = 0; w11 = 0; w22 = 0; w33 = 0; w44 = 0;
while epoch <= max_epoch
for i = 1 : 20 %jumlah input
for j = 1 : 20 %jumlah indeks input
w11 = w11 + ((pola(i,j) - w1_awal(j))^2); w22 = w22 + ((pola(i,j) - w2_awal(j))^2); w33 = w33 + ((pola(i,j) - w3_awal(j))^2); w44 = w44 + ((pola(i,j) - w4_awal(j))^2); end
w11 = sqrt(w11); w22 = sqrt(w22); w33 = sqrt(w33); w44 = sqrt(w44);
%mencari nilai minimum data = [w11 w22 w33 w44]; if (min(data) == w11) for j = 1 : 20
w1_baru(j) = w1_awal(j) + a * (pola(i,j) - w1_awal(j));
end
w1_awal = w1_baru; elseif (min(data) == w22) for j = 1 : 20
w2_baru(j) = w2_awal(j) + a * (pola(i,j) - w2_awal(j));
end
w2_awal = w2_baru; elseif (min(data) == w33) for j = 1 : 20
w3_baru(j) = w3_awal(j) + a * (pola(i,j) - w3_awal(j));
end
for j = 1 : 20
w4_baru(j) = w4_awal(j) + a * (pola(i,j) - w4_awal(j));
end
w4_awal = w4_baru; end
end
epoch = epoch + 1; a = 0.1 * a;
end
xlswrite('lvq.xlsx',epoch,'bobot','B2'); xlswrite('lvq.xlsx',w1_awal,'bobot','B3:U3'); xlswrite('lvq.xlsx',w2_awal,'bobot','B4:U4'); xlswrite('lvq.xlsx',w3_awal,'bobot','B5:U5'); xlswrite('lvq.xlsx',w4_awal,'bobot','B6:U6');
waktupengujian = toc(tStart);
set(handles.waktu,'string',waktupengujian);
pesan = msgbox('Data telah dilatih', 'Berhasil');
% ---LatihBAM
delete(handles.figure1)
% ---function ujibam_Callback(hObject, eventdata, handles)
UjiBAM
delete(handles.figure1)
UjiLVQ.m
function varargout = UjiLVQ(varargin) % UJILVQ M-file for UjiLVQ.fig
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @UjiLVQ_OpeningFcn, ... 'gui_OutputFcn', @UjiLVQ_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
gui_mainfcn(gui_State, varargin{:});
% --- Executes on button press in tombolreset.
function tombolreset_Callback(hObject, eventdata, handles) xlswrite('datalvq.xlsx', '0','nilai','B2:U2');
set(handles.namapenyakit,'String','','Enable','on'); set(handles.jenisobat,'String','','Enable','on'); set(handles.waktuuji,'String','','Enable','on'); set(handles.Sul,'Value',0);
set(handles.Nye,'Value',0); set(handles.Mun,'Value',0); set(handles.Ada,'Value',0); set(handles.Lam,'Value',0); set(handles.Atp,'Value',0); set(handles.Sen,'Value',0); set(handles.Kem,'Value',0); set(handles.Ane,'Value',0); set(handles.Ras,'Value',0); set(handles.Pen,'Value',0); set(handles.Tm,'Value',0); set(handles.Md,'Value',0); set(handles.Kel,'Value',0); set(handles.Keh,'Value',0); set(handles.Sak,'Value',0);
% --- Executes on button press in tombolhasil.
function tombolhasil_Callback(hObject, eventdata, handles) tStart=tic;
a = get(handles.Sul,'Value'); b = get(handles.Per,'Value'); c = get(handles.Bat,'Value'); d = get(handles.Mua,'Value'); e = get(handles.Sua,'Value');
f = get(handles.Nye,'Value'); g = get(handles.Mun,'Value'); h = get(handles.Ada,'Value'); i = get(handles.Lam,'Value'); j = get(handles.Atp,'Value');
k = get(handles.Sen,'Value'); l = get(handles.Kem,'Value'); m = get(handles.Ane,'Value'); n = get(handles.Ras,'Value'); o = get(handles.Pen,'Value');
p = get(handles.Tm,'Value'); q = get(handles.Md,'Value'); r = get(handles.Kel,'Value'); s = get(handles.Keh,'Value'); t = get(handles.Sak,'Value');
penyakit= [a b c d e f g h i j k l m n o p q r s t];
for indeks = 1 : 20
if (penyakit(indeks) == 0) penyakit(indeks) = -1; else
penyakit(indeks) = 1; end
end
w1_awal = xlsread('lvq.xlsx', 'bobot', 'B3:U3'); w2_awal = xlsread('lvq.xlsx', 'bobot', 'B4:U4'); w3_awal = xlsread('lvq.xlsx', 'bobot', 'B5:U5'); w4_awal = xlsread('lvq.xlsx', 'bobot', 'B6:U6');
for i = 1 : 20
bobot1 = bobot1 + ((penyakit(i) - w1_awal(i))^2); bobot2 = bobot2 + ((penyakit(i) - w2_awal(i))^2); bobot3 = bobot3 + ((penyakit(i) - w3_awal(i))^2); bobot4 = bobot4 + ((penyakit(i) - w4_awal(i))^2); end
matriks =[ bobot1 bobot2 bobot3 bobot4];
if (min(matriks) == bobot1)
namapenyakit ='Radang Kerongkongan (reflux oesophagitis)'; jenisobat ='Ranitidin , Omeprazole , Domperidone , Antasida , Sukralfat';
elseif (min(matriks) == bobot2)
namapenyakit ='Radang lambung (gastritis)';
jenisobat ='Omeprazole , Antasida , Bismuth , Amoxixilin , Claritromixin';
elseif (min(matriks) == bobot3)
namapenyakit ='Tukak Lambung-Usus (ulcus pepticum)'; jenisobat ='Antasida , Bismuth , Sukralfat , Ranitidin , Omeprazole ';
elseif (min(matriks) == bobot4) namapenyakit ='Kanker Lambung';
jenisobat ='Kemoterapi , Radiasi , Operasi'; else
namapenyakit ='Tidak Dikenali'; end
set(handles.namapenyakit,'string',namapenyakit); set(handles.jenisobat,'string',jenisobat);
guidata(hObject, handles); waktupengujian = toc(tStart);
set(handles.waktuuji,'string',waktupengujian);
function namapenyakit_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties. function namapenyakit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white')
Bantuan.m
function varargout = Bantuan(varargin) % BANTUAN M-file for Bantuan.fig
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Bantuan_OpeningFcn, ... 'gui_OutputFcn', @Bantuan_OutputFcn, ... 'gui_LayoutFcn', [] , ...
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end
% ---function keluar_Callback(hObject, eventdata, handles)
choice= questdlg ('Apakah Anda Ingin Keluar?','Konfirmasi',... 'Ya','Tidak','Tidak');
switch choice case 'Ya' close all; end
% ---function ujibam_Callback(hObject, eventdata, handles)
UjiBAM
delete(handles.figure1)
% ---function ujilvq_Callback(hObject, eventdata, handles)
UjiLVQ
delete(handles.figure1)
% ---function latihbam_Callback(hObject, eventdata, handles)
LatihBAM
delete(handles.figure1)
% ---function latihlvq_Callback(hObject, eventdata, handles)
LatihLVQ