title: Matlab 2D-array indexing contradiction between for loop and vectorised version
body: <p>I know there's been lots of indexing question on here, but this one seems puzzling to me, hope someone's got a quick answer for me, will understand if this one gets deleted though. I've got a 2D a-by-b array x and want to get from another array y this :    </p>
  
  <pre><code>for i=1:b        
  x(:,i) = y( (i-1) * k+1 : (i-1) * k+a )
  end
  </code></pre>
  
  <p>without a for loop, like this :</p>
  
  <pre><code>x(:,1:b) = y( (0:b-1) * k+1 : (0:b-1) * k+a )
  </code></pre>
  
  <p>but to no avail, I get </p>
  
  <p>"Subscripted assignment dimension mismatch."</p>
  
  <p>Any ideas? Thank you in advance.</p>