Arrange clustered rows based on their label value
Mostrar comentarios más antiguos
Suppose I have a matrix of size 100 x 42.
Now I do kmeans clustering
[idx,C] = kmeans(XTrain,8);
Suppose the first 10 rows of XTrain have idx 1
I need to get the labels from YTrain
Suppose the labels of YTrain are
[1 1 1 2 2 2 2 3 3 3];
Now I want to store the 10 rows of XTrain having idx = 1, according to the label YTrain in a cell array to get a cell array of size
42 x 3
42 x 4
42 x 3
I need to do the same with the attached mat-file, so that I finally get a cell array newXTrain and new label newYTrain as shown in the attached image Output.png

In my example instead of 12 it will be 42.
Please could someone help me to solve it.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre k-Means and k-Medoids Clustering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!