Your âTâ matrix must become a cell array. See my sample of âTâ for an example.
Once you do that, I would do something like this:
Y = [12.004
13.1573
11.1665
11.8082
12.2129
12.8075
12.4167
11.5708
12.5798
13.7489];
T={'cluster2'; 'cluster1'; 'cluster3'; 'cluster9'; 'cluster0'; 'cluster7'; 'cluster4'};
[UnqClust,~,idx] = unique(T);
Out = Y(idx);
for k1 = 1:length(idx)
fprintf(1, '\t%s\t%.4f\n', T{k1}, Out(k1))
end
cluster2 11.1665
cluster1 13.1573
cluster3 11.8082
cluster9 12.4167
cluster0 12.0040
cluster7 12.8075
cluster4 12.2129
Best Answer