title: How to divide any sized image to equal sized block using only for loop in matlab?
body: <p><strong>How to divide image to equal sized blocks using simple matlab for loop only?</strong>
  As a beginner I have tried but its showing error.I have done same thing using <code>mat2cell</code> and using simple calculation.</p>
  
  <p>This is my code:</p>
  
  <pre><code>[rows, columns, numberOfColorChannels] = size(p); 
  r4 = int32(rows/4); 
  c4 = int32(columns/4); 
  % Extract images. 
  image1 = p(1:r4, 1:c4); 
  image2 = p(1:r4, c4+1:2*c4); 
  image3 = p(1:r4, 2*c4+1:3*c4); 
  image4 = p(1:r4, 3*c4+1:4*c4); 
  </code></pre>
  
  <p>I need to do it with a for loop only.</p>