title: Drawing 256 squares/rectangles in MATLAB
body: <p>I am trying to draw 256 small sized squares using MATLAB rectangle function. If I am drawing abut 10 squares then the following works fine: </p>
  
  <pre><code>for i=1:2:40
  
  rectangle('Position',[5,3+i,0.3,0.3],...
        'Curvature',[0,0],...
       'LineStyle','-', 'faceColor', 'black')
  
  end
  
  axis off; 
  
  daspect([1,1,1])
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/FrZRE.png" alt="enter image description here"></p>
  
  <p>But when I change the last value of for loop to 512 (to draw 256 squares), it is not printing properly:</p>
  
  <p><img src="https://i.stack.imgur.com/yCqWM.png" alt="enter image description here"> </p>
  
  <p>Here is the magnified version of a section of the above image:
  <img src="https://i.stack.imgur.com/e9YWP.png" alt="enter image description here"></p>
  
  <p>This image clearly shows some thing is wrong somewhere as the sides of the squares are not perfectly equal and that the <strong>squares are becoming smaller in size for higher no. of squares</strong>: Can anybody help me draw the squares perfectly <strong>with size not diminishing</strong>,  ? (I don't have any issues with memory, and I can tolerate multiple pages scrolling down for covering entire squares )  </p>