title: MATLAB: Create a block diagonal matrix with same repeating block
body: <p>I have a matrix <strong>K</strong> of dimensions <em>n x n</em>. I want to create a new block diagonal matrix <strong>M</strong> of dimensions <em>N x N</em>, such that it contains <em>d</em> blocks of matrix <strong>K</strong> as its diagonal.</p>
  
  <p>I would have directly used <em>M = blkdiag(K,K,K)</em> etc. had <em>d</em> been smaller. Unfortunately, <em>d</em> is very large and I don't want to manually write the formula with <em>d</em> exactly same arguments for the <em>blkdiag()</em> function.</p>
  
  <p>Is there any shorter, smarter way to do this?</p>