title: Vector to identity matrix
body: <p>I have a vector <code>K=[3,4,5,...]</code> where the number of elements of <code>K</code> = <code>n</code>.</p>
  
  <p>I also have a 3xn identity matrix.</p>
  
  <p>I would like to place the numbers from <code>K</code> on the diagonal of the identity matrix i.e for <code>n=3</code></p>
  
  <p><code>K=[3,4,5]</code></p>
  
  <p>V=</p>
  
  <pre><code> 3     0     0
   0     4     0
   0     0     5
  </code></pre>
  
  <p>I thought that <code>diag(V)=K.</code>' would work. But that presents an error.</p>
  
  <p>How can I go about doing this?</p>