title: Segment the image into blocks
body: <p>Let us consider an image Y of size 512x512.</p>
  
  <p>The code below serves to segment the image Y into blocks where each block take the size 8x8.</p>
  
  <pre><code>Matlab Code:
  
  for m = 1:64
      for n = 1:64
          subX = Y(8*(m-1)+1:8*m,8*(n-1)+1:8*n);
      end
  end
  </code></pre>
  
  <p>What i need in this question is to resolve my two problems below:</p>
  
  <p><strong>1)</strong> to segment the image X into 8 x 8 number of blocks (not the size is 8x8 but the number of blocks must be 8x8). In this case the image will become segmented into 64 blocks where each block being contain 512/64 pixels =8 pixels.</p>
  
  <p><strong>2)</strong> it is the same concept of 1), but in this case, i want to segment the image into 10x10 number of blocks. therefore the image will become segmented into 100 blocks. But we can now notice that each block being containing 512/100 = 5.12 pixels!! so it's float!</p>
  
  <p>PLEASE help me to write a unique code which can be resolve my two problems at the same time.</p>
  
  <p>Best Regards,</p>
  
  <p>Christina.</p>