title: Finding the distribution of length of islands in a 2D array?
body: <p>I will explain my question using an example. Imagine you have a 2D matrix like below:</p>
  
  <pre><code>5 4 3 8 0 0
  5 4 2 9 1 0
  5 6 2 7 2 0
  5 4 7 9 0 0
  5 6 7 1 2 0
  </code></pre>
  
  <p>By islands I mean column groups of same elements (except zeros).
  I would like to find the histogram of length of <code>islands</code> except those consisting of zero elements.</p>
  
  <p><a href="https://i.stack.imgur.com/gRNtb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gRNtb.png" alt="enter image description here"></a></p>
  
  <p>This matrix has</p>
  
  <pre><code>island-length occurrence
    5               1
    2               3
    1               12
  </code></pre>
  
  <p>How can I realize this task using Matlab ?</p>