function btnBrowse_Callback(hObject, eventdata, handles)
[namafile,direktori]=uigetfile({'*.xls;*.xlsx','file excel(*.xls,*.xlsx)';'*.*','semua file(*.*)'},'buka file excell');
path=fullfile(direktori,namafile);
[A0,B,C]=xlsread(path);
global judul;
set(handles.edt1,'String',path);
bar=size(C,1);%151
col=size(C,2);
data=C(2:bar,1:col);
A=C(2:bar,3:col);
A=cell2mat(A);
minX1=min(A(:,1));
maxX1=max(A(:,1));
minX2=min(A(:,2));
maxX2=max(A(:,2));
minX3=min(A(:,3));
maxX3=max(A(:,3));
minX4=min(A(:,4));
maxX4=max(A(:,4));
minX5=min(A(:,5));
maxX5=max(A(:,5));
minX6=min(A(:,6));
maxX6=max(A(:,6));
minX7=min(A(:,7));
maxX7=max(A(:,7));
sel1=maxX1-minX1;
sel2=maxX2-minX2;
sel3=maxX3-minX3;
sel4=maxX4-minX4;
sel5=maxX5-minX5;
sel6=maxX6-minX6;
se17=maxX7-minX7;
nom=linspace(1,bar-1,bar-1);
set(handles.uitable1,'data',data,'ColumnName',judul,'RowName',nom);
set(handles.uitable1,'Userdata',data);
var1=['Dimensi DataSet ' num2str(bar-1) ' x ' num2str(col) ' BK'];
set(handles.txt1,'String',var1);
baris={'Min','Max','Sel'};
judul2=judul(1,3:9);
dataminmax=[minX1,minX2,minX3,minX4,minX5,minX6,minX7;
maxX1,maxX2,maxX3,maxX4,maxX5,maxX6,maxX7;
sel1,sel2,sel3,sel4,sel5,sel6,se17
];
set(handles.uitable2,'data',dataminmax,'ColumnName',judul2,'RowName',baris);
set(handles.uitable2,'Userdata',dataminmax);
save data.mat data;
save dataminmax.mat dataminmax;
function btnClear_Callback(hObject, eventdata, handles)
set(handles.edt1,'String','');
set(handles.txt1,'String','Dimensi Tabel AxB');
set(handles.edt1,'String','');
set(handles.edt1,'String','');
set(handles.edit14,'String','');
set(handles.edit15,'String','');
set(handles.edit16,'String','');
set(handles.edCluster,'String','');
set(handles.edOut,'String','');
set(handles.edi1,'String','');
set(handles.edi2,'String','');
set(handles.edi3,'String','');
set(handles.edi4,'String','');
set(handles.edi5,'String','');
set(handles.edi6,'String','');
set(handles.edi7,'String','');
set(handles.edn1,'String','');
set(handles.edn2,'String','');
set(handles.edn3,'String','');
set(handles.edn4,'String','');
set(handles.edn5,'String','');
set(handles.edn6,'String','');
set(handles.edn7,'String','');
set(handles.uitable1,'data',[],'ColumnName',[],'RowName',[]);
set(handles.uitable1,'Userdata',[]);
set(handles.uitable2,'data',[],'ColumnName',[],'RowName',[]);
set(handles.uitable2,'Userdata',[]);
set(handles.uitable3,'data',[],'ColumnName',[],'RowName',[]);
set(handles.uitable3,'Userdata',[]);
set(handles.uitable5,'data',[],'ColumnName',[],'RowName',[]);
set(handles.uitable5,'Userdata',[]);
%axes(handles.axes2);
cla(handles.axes2,'reset');
cla(handles.axes3,'reset');
function btnNorm_Callback(hObject, eventdata, handles)
% data= get(handles.uitable1,'Userdata');
% dminmax= get(handles.uitable2,'Userdata');
load data.mat;
load dataminmax.mat;
minX1=dataminmax(1,1);
maxX1=dataminmax(2,1);
minX2=dataminmax(1,2);
maxX2=dataminmax(2,2);
minX3=dataminmax(1,3);
maxX3=dataminmax(2,3);
minX4=dataminmax(1,4);
maxX4=dataminmax(2,4);
minX5=dataminmax(1,5);
maxX5=dataminmax(2,5);
minX6=dataminmax(1,6);
maxX6=dataminmax(2,6);
minX7=dataminmax(1,7);
maxX7=dataminmax(2,7);
%norm={};
normalize=[];
dataAsli=data;%1754x9cell
bar=size(data,1);
col=size(data,2);
data=dataAsli(:,3:col);
for i=1:bar
v1=(cell2mat(data(i,1))-minX1)/(maxX1-minX1);
v2=(cell2mat(data(i,2))-minX2)/(maxX2-minX2);
v3=(cell2mat(data(i,3))-minX3)/(maxX3-minX3);
v4=(cell2mat(data(i,4))-minX4)/(maxX4-minX4);
v5=(cell2mat(data(i,5))-minX5)/(maxX5-minX5);
v6=(cell2mat(data(i,6))-minX6)/(maxX6-minX6);
v7=(cell2mat(data(i,7))-minX7)/(maxX7-minX7);
%gab=[{v1},{v2},{v3},{v4},{v5},{v6},{v7}];
gab=[v1,v2,v3,v4,v5,v6,v7];
normalize(i,:)=gab;
end
nom=linspace(1,bar,bar);
global judul;
judul2=judul(1,3:9);
set(handles.uitable3,'data',normalize,'ColumnName',judul2,'RowName',nom);
set(handles.uitable3,'Userdata',normalize);
save normalize.mat normalize;
======
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
try
data = get(handles.uitable1, 'Data');
index = eventdata.Indices;
R= eventdata.Indices(1);
C= eventdata.Indices(2);
mdata=data(R,:);
D1=cell2mat(mdata(1));
D2=cell2mat(mdata(2));
D3=cell2mat(mdata(3));
D4=cell2mat(mdata(4));
D5=cell2mat(mdata(5));
D6=cell2mat(mdata(6));
D7=cell2mat(mdata(7));
D8=cell2mat(mdata(8));
D9=cell2mat(mdata(9));
load dataminmax.mat;
minX1=dataminmax(1,1);
maxX1=dataminmax(2,1);
minX2=dataminmax(1,2);
maxX2=dataminmax(2,2);
minX3=dataminmax(1,3);
maxX3=dataminmax(2,3);
minX4=dataminmax(1,4);
maxX4=dataminmax(2,4);
minX5=dataminmax(1,5);
maxX5=dataminmax(2,5);
minX6=dataminmax(1,6);
maxX6=dataminmax(2,6);
minX7=dataminmax(1,7);
maxX7=dataminmax(2,7);
v1=(D3-minX1)/(maxX1-minX1);
v2=(D4-minX2)/(maxX2-minX2);
v3=(D5-minX3)/(maxX3-minX3);
v4=(D6-minX4)/(maxX4-minX4);
v5=(D7-minX5)/(maxX5-minX5);
v6=(D8-minX6)/(maxX6-minX6);
v7=(D9-minX7)/(maxX7-minX7);
set(handles.edi1,'String',num2str(D3));
set(handles.edi2,'String',num2str(D4));
set(handles.edi3,'String',num2str(D5));
set(handles.edi4,'String',num2str(D6));
set(handles.edi5,'String',num2str(D7));
set(handles.edi6,'String',num2str(D8));
set(handles.edi7,'String',num2str(D9));
set(handles.edn1,'String',num2str(v1));
set(handles.edn2,'String',num2str(v2));
set(handles.edn3,'String',num2str(v3));
set(handles.edn4,'String',num2str(v4));
set(handles.edn5,'String',num2str(v5));
set(handles.edn6,'String',num2str(v6));
set(handles.edn7,'String',num2str(v7));
load data.mat;
data_awal=data(:,3:9);
data_awal = cell2mat(data_awal);
max_data = max(data_awal);
min_data = min(data_awal);
cntr_baru=get(handles.uitable5,'Userdata');
myori=[D3,D4,D5,D6,D7,D8,D9];
mydata=[v1,v2,v3,v4,v5,v6,v7];
Bclus=str2num(get(handles.edCluster,'String'));
r=0.5;
sigmascluster = (r .* (max_data - min_data)) / sqrt(8);
sb_temp = sigmascluster.^2;
sb = 2.*sb_temp;
%derajat keanggotaan tiap data pada tiap klaster
[n,m]=size(mydata);
hasil=[];
for j = 1:m
for k = 1:Bclus
%hasil(j,k)=(((mydata(1,j)-cntr_baru(k,j)).^2)./sb(j));
hasil(j,k)=(((myori(1,j)-cntr_baru(k,j)).^2)./sb(j));
end
end
%whos hasil % 7x8
su = sum(hasil) ;%1x8
msu=min(su);
index=0;
for i =1: Bclus
if msu==su(1,i)
index=i;
break;
end
end
set(handles.edOut,'String',num2str(index));
catch
disp('menunggu proses....');
end
function uitable5_CellSelectionCallback(hObject, eventdata, handles)
CA=handles.CA;
CN=handles.CN;
try
data = get(handles.uitable5, 'Data');
index = eventdata.Indices;
R= eventdata.Indices(1);
C= eventdata.Indices(2);
mdata=data(R,:);
index=R;%cell2mat(mdata(8));
TA=CA{index};
psn=['List Data Asli Cluster ' num2str(index) ' (' num2str(size(TA,1)) ')'];
disp(psn);
disp(TA);
TN=CN{index};
psn=['List Data Normalisasi Cluster ' num2str(index) ' (' num2str(size(TN,1)) ')'];
disp(psn);
disp(TN);
catch
disp('Menunggu Proses Data....');
end
guidata(hObject,handles);
###############
dataPie=[];
explode=[];
Labels=[];
for i = 1:G
ind{i} = idx == i;
C_norm{i}=N(idx==i,:); %menampilkan data normalisasi sesuai cluster
C{i} = datareal(idx==i,:); %menampilkan nama kelurahan sesuai clusternya
CA{i} = data_awal(idx==i,:) ;
C_stat{i} = stat(CA{i}); %menampilkan stat setiap cluster
cSSE{i} = hitung_sse(C_norm,cntr,i);
cMAE{i} = hitung_mae(C_norm,cntr,i);
[b,c]=size(C{i});
dataPie(1,i)=b;
Ex=1;
if i>3
Ex=0;
end
explode(1,i)=Ex;
Labels{i}=['C' num2str(i)];
psn1=['Cluster ke ' num2str(i)];
disp(psn1);
psn2=['Banyak Data ' num2str(b) ' Item'];
disp(psn2);
disp('Data Statistik:');
disp(C_stat{i});
disp('Nilai SSE:');
disp(cSSE{i});
disp('Nilai MAE:');
disp(cMAE{i});
disp('--------------------------------');
end
axes(handles.axes2);
pie(dataPie,Labels);
handles.CA= C;
handles.CN= C_norm;
handles.idx=idx;
guidata(hObject,handles);
=========
hold on
scatter3(cntr1,cntr2,cntr3);
xlabel(label1); ylabel(label2); zlabel(label3);
title('Visualisasi Custer Terhadap 3 Variabel')
hold off
rotate3d(handles.axes3,'on');