title: How to append arrays in matrix?
body: <p>I have the following vectors:</p>
  
  <pre><code>a = 1:4;
  b = zeros(8,8);
  </code></pre>
  
  <p>and I would like to append <code>a</code> in <code>b</code> in the following manner:</p>
  
  <pre><code>b = [1 2 3 4 0 0 0 0
      0 1 2 3 4 0 0 0
      0 0 1 2 3 4 0 0
      0 0 0 1 2 3 4 0
      0 0 0 0 1 2 3 4 
      0 0 0 0 0 1 2 3
      0 0 0 0 0 0 1 2
      0 0 0 0 0 0 0 1
      0 0 0 0 0 0 0 0]
  </code></pre>
  
  <p>I want to achieve this using a for loop, so I tried:</p>
  
  <pre><code>for i = 2:size(b,1)
     b(i,i:length(a))=a; 
  end
  </code></pre>
  
  <p>But I get the following error <code>Subscripted assignment dimension mismatch.</code></p>
  
  <p>Can anybody please help me solve this?</p>