title: MATLAB printing out time as a string
body: <p>What is the most efficient way to print out time as HH:MM:SS?</p>
  
  <p>I have it set up where my time is x seconds. Then I calculate the hours, minutes, and left over seconds associated with the x seconds.</p>
  
  <p>Then when I want to print it out as a string onto a figure, I do:</p>
  
  <pre><code>sprintf('Time: %d:%d:%d', hours, minutes, seconds);
  </code></pre>
  
  <p>Unfortunately, this looks ugly as if I have hours or minutes equal to 0, I get something like 0:0:23.</p>
  
  <p>I suppose I can change the hours, minutes, seconds to a string before doing the sprintf. Is there a more efficient MATLAB way though? Thanks!</p>