title: Push Values Onto a Vector in a Control Loop
body: <p>In MATLAB is there a way to define a variable say <em>runningValue</em> and push values onto it in succession an unknown number of times?</p>
  
  <p>What I have been doing is something like this:</p>
  
  <pre><code>runningValue = 0;
  for j=1:length(someVector)
      ...
      runningValue(end+1) = (some value);
      ...
  endfor
  </code></pre>
  
  <p>But this forces a leading 0.  I know that after all is done I could just put <em>j(1) = [];</em> but I was wondering if there is a more elegant way to do this.</p>
  
  <p>Note that the length of the <em>runningValue</em> variable is not a priori known; in particular, we are not populating <em>length(someVector)</em> elements, referring to the pseudocode above, and the <em>j</em> index is no of use.</p>