title: Matlab array of struct : Fast assignment
body: <p>Is there any way to "vector" assign an array of struct. </p>
  
  <p>Currently I can </p>
  
  <pre><code>edges(1000000) = struct('weight',1.0); //This really does not assign the value, I checked on 2009A.
  for i=1:1000000; edges(i).weight=1.0; end; 
  </code></pre>
  
  <p>But that is slow, I want to do something more like</p>
  
  <pre><code>edges(:).weight=[rand(1000000,1)]; //with or without the square brackets. 
  </code></pre>
  
  <p>Any ideas/suggestions to vectorize this assignment, so that it will be faster. </p>
  
  <p>Thanks in advance.</p>