Finding the position within a matrix
显示 更早的评论
Hi,
I have many clusters of zeros surrounded by ones in my binary matrix. How can I find the position of the clusters of zeros without returning positions of every single zero in the cluster. I just need the position of one zero within each of the clusters.
Thanks for your help.
Adelaide:)
回答(1 个)
Andrei Bobrov
2012-6-8
eg
A = [...
1 1 1 1 1 1 1 1 1 1
1 0 0 1 1 1 0 0 1 1
1 0 0 0 1 1 1 0 0 1
1 1 0 1 1 1 1 0 0 1
1 1 1 1 1 1 1 0 0 0
1 1 1 1 0 0 1 1 1 1
1 0 1 1 0 0 1 1 1 1
1 0 1 0 0 1 1 1 0 1
1 1 1 0 0 1 0 1 0 1
1 1 1 1 1 1 1 1 1 1];
STATS = regionprops(~A, 'Centroid' , 'PixelList' )
类别
在 帮助中心 和 File Exchange 中查找有关 Univariate Discrete Distributions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!