hey guys, I have a Cell Array a and am using cell2mat function for further clustering analysis, lets say:
a = {[1 2 3; 7 8 9], [4 5 6;10 11 12; 13 14 15]};b = cell2mat(a(:));rng(2)k=2;[idx] = kmeans(b,k);which_in_cluster = cell(k,1);for j = 1:k which_in_cluster{j} = find(idx == j);endCluster_1 = b(which_in_cluster{1,1},:); % 1st Cluster
Cluster_2 = b(which_in_cluster{2,1},:); % 2nd Cluster
Cluster_1 = 7 8 9 10 11 12 13 14 15Cluster_2 = 1 2 3 4 5 6
I am now looking for a way to know in which Cell number and row these clusters have originally been in a. So in this example:
Cluster_1 = 7 8 9 % This has been in Cell number 1, row index 2 of a
10 11 12 % This has been in Cell number 2, row index 2 of a
13 14 15 % This has been in Cell number 2, row index 3 of a
Any help is greatly appreciated.
Best Answer