Clear Filters
Clear Filters

Finding labels of a linkage.

1 view (last 30 days)
BHAGYALAKSHMI M
BHAGYALAKSHMI M on 9 Mar 2020
Answered: Ameer Hamza on 9 Mar 2020
How can I find the labels of the linkage clustering? Anybody, Please help me.

Answers (1)

Ameer Hamza
Ameer Hamza on 9 Mar 2020
Similar to your other question, I used the same dataset to show how to determine the cluster labels
You need to use the function cluster to extract the cluster number of each data point. For example,
data=readtable('Liverxl.xlsx', 'ReadVariableNames', false);
data.Var2 = findgroups(data.Var2); % convert column
data.Var10(isnan(data.Var10)) = 0; % place 0 in empty cells
data = table2array(data);
maximum_num_clusters = 5;
Z = linkage(data, 'average');
cluster_labels = cluster(Z, 'Maxclust', maximum_num_clusters);
clusters = splitapply(@(x) {x}, data, cluster_labels);
Again here, clusters is a cell array.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!