% This program illustrates how to upload tabular data (diabetes.dat),
% create hierarchical clusters, and plot a dendrogram visualizing the clusters

clear; close

[X,varnames,casenames] = tblread('diabetes.dat', ',');

Z1 = linkage(X,'single','euclidean')
[H1,T1] = dendrogram(Z1,'colorthreshold','default');
set(H1,'LineWidth',2)

Z2 = linkage(X,'complete','euclidean')
[H2,T2] = dendrogram(Z2,'colorthreshold','default');
set(H2,'LineWidth',2)

Z3 = linkage(X,'single','cityblock')
[H3,T3] = dendrogram(Z3,'colorthreshold','default');
set(H3,'LineWidth',2)

Z4 = linkage(X,'complete','cityblock')
[H4,T4] = dendrogram(Z4,'colorthreshold','default');
set(H4,'LineWidth',2)

