title: Element-wise array replication in Matlab
body: <p>Let's say I have a one-dimensional array:
  <code><pre>
  a = [1, 2, 3];
  </pre></code></p>
  
  <p>Is there a built-in Matlab function that takes an array and an integer <code>n</code> and replicates each
  element of the array n times?</p>
  
  <p>For example calling <code>replicate(a, 3)</code> should return <code>[1,1,1,2,2,2,3,3,3]</code>.</p>
  
  <p>Note that this is not at all the same as <code>repmat</code>.  I can certainly implement <code>replicate</code> by doing <code>repmat</code> on each element and concatenating the result, but I am wondering if there is a built in function that is more efficient.</p>