image thumbnail


version (748 KB) by Matt Fig
Finds all "islands" which are 4-connected components in a matrix.


Updated 23 Sep 2008

View License

ISLANDS finds all "islands" which are 4-connected components in a matrix. The function will return three output arguments, including the largest connected island in the input matrix. See the detailed help for all descriptions.

Inspired by a recent puzzler posted here:
and by the submission from Tim Davis.

Also included is a MEX-File version which runs faster than the M-File version.

Tested on 2007a and 2007b.

Please email me about bugs and other concerns. Thanks.

Cite As

Matt Fig (2022). ISLANDS (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!