Jitin Singla
Jitin Singla

Reputation: 117

Finding which row is assigned to which cluster - kmeans clustering Matlab

idx4 = kmeans(A,4);
silhouette(A,idx4,'Euclidean')

I have matrix A of dimensions [492 x 5148]. I did kmeans clustering on matlab using above command and plotted using silhouette function. It shows 4 clusters beautifully. But now I want to know which row of matrix A is assigned to which cluster. How to know that?

Upvotes: 0

Views: 216

Answers (1)

Javi
Javi

Reputation: 3610

From the documentation, http://www.mathworks.es/es/help/stats/kmeans.html , you will see that idx4 contains the indices of the cluster for each row in A.

That is, the value of idx4(1) is the index of the cluster of the row A(1,:).

Upvotes: 1

Related Questions