title: Comparing adjacent elements in MATLAB
body: <p>Does anyone know how I can compare the elements in an array with the adjacent elements?</p>
  
  <p>For example, if I have an array:</p>
  
  <pre><code>0 0 0 1 1 1 1 0 
  0 1 1 1 1 1 1 0 
  0 1 0 1 1 1 1 0
  0 1 1 1 1 1 0 0
  0 0 0 0 1 1 1 1
  1 1 1 1 1 1 1 1
  </code></pre>
  
  <p>Is there a way to cycle through each element and perform a logical test of whether the elements around it are equal to 1?</p>