title: Matlab addtodate function
body: <p>I am trying to use "addtodate" function of matlab. Am I correct in observing that it can't be applied to vector of dates ?</p>
  
  <p>If that is the case how do I add an hour to each of the dates in the following vector of dates:</p>
  
  <pre><code>stDt = datenum('2/28/2014');
  endDt = datenum('4/29/2014');
  interval = (datenum(1987,0,0,1,0,0)-datenum(1987,0,0,0,0,0));
  z1 = datenum(stDt):interval:datenum(endDt);
  z = datestr(addtodate(z1,1,'hour'));  
  </code></pre>
  
  <p>The last line fails with following error:</p>
  
  <pre><code>??? Error using ==&gt; addtodate at 42
  Date number must be a numeric scalar.
  </code></pre>