Code covered by the BSD License  

Highlights from
(simple) Tool for estimating the number of clusters

from (simple) Tool for estimating the number of clusters by Kaijun Wang
12 validity indices, illustrate estimation of the number of clusters

ind2cluster(labels)
function [clusters, newlabels] = ind2cluster(labels)

C = unique(labels);
newlabels = labels;
k = length(C);
clusters = cell(1,k);
for i = 1:k
  ind = find(labels==C(i));
  clusters{i} = ind;
  newlabels(ind) = i;
end

Contact us at files@mathworks.com