Finding the position within a matrix
Show older comments
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:)
2 Comments
per isakson
on 8 Jun 2012
did you search for cluster in the file exchange?
Adelaide
on 8 Jun 2012
Answers (1)
Andrei Bobrov
on 8 Jun 2012
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' )
Categories
Find more on Univariate Discrete Distributions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!