MATLAB: How to start time from 0s

clockgui

Hi, I am creating a GUI in matlab. I have a button and the time when I press the button is recorded. I manage to do that using clock. However, is there any way the start of the time is from 0s? Thanks.

Best Answer

Here are two simple ways to start a timer that counts from zero:
  • Use tic and toc to do the timing.
  • Use now, save the start time, and subtract this from all subsequent time values.
Related Question