how to cluster binary matrix in matlab ?
显示 更早的评论
let
A=[1 0 0 0 0 0 0 1; 1 1 1 1 1 1 0 1; 0 0 0 0 0 0 1 1; 1 1 1 1 1 1 0 1; 0 0 0 0 0 0 1 1]
how to cluster this matrix A?
回答(1 个)
Walter Roberson
2016-5-30
1 个投票
Under at least two reasonable definitions of "cluster", all of the values that are 1 are in one cluster and all of the values that are 0 are in another cluster. The most obvious "reasonable definition" there involves value, but it also happens that if you use 8-connectivity then every 1 value is "connected" to every other 1 value through a chain.
My speculation is that what you want is bwlabel() with 4 connectivity.
5 个评论
Image Analyst
2016-5-30
That's my guess too.
[labeledImage, numberOfRegions] = bwlabel(A);
kumud alok
2016-5-31
Walter Roberson
2016-5-31
[clusters, ~, clusteridx] = unique(A,'rows');
kumud alok
2016-6-1
kumud alok
2016-6-1
类别
在 帮助中心 和 File Exchange 中查找有关 Hierarchical Clustering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!