Watch this Author's files
Broken in Matlab 2014b (preview). I updated the code to ignore class parents that begin with "matlab."; see https://gist.github.com/drdan14/49bb6eade8540aecf7d9
Works perfectly. Excellent work!
This is a great idea for a function, but it unfortunately fails in some cases. Matlab has a more robust method built in: bwboundaries.
Does just what I wanted