kmeans clustering of matrices/arrays
3 次查看(过去 30 天)
显示 更早的评论
I have a 1X52 cell. Each element of cell is a 33X35 matrix. Need to classify these matrices using kmeans. I tried kmeans(X,k). But it demands X to be a matrix and not a cell.
Is there any other way?
2 个评论
Wayne King
2014-1-5
编辑:Wayne King
2014-1-5
Are you trying to work with each matrix separately, or are you trying to cluster the large matrix -- (52*33,35)
assuming each row is an observation on 35 variables and the variables are the same for each matrix.
回答(1 个)
Image Analyst
2014-1-5
So make it a 3D array, which I would have done in the first place. Why mess with cells when you don't have to?
Anyway, since you have cells, just extract X from the cell and call kmeans
for c = 1 : length(myCellArray)
X = myCellArray{c}; % Extract double array from cell.
out = kmeans(X,k);
end
2 个评论
Walter Roberson
2014-1-6
That can happen by chance with random initialization. It can, though, also happen if you have a number of duplicate points.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!