The NOW function returns the serial number (that is, the date and time of encoding). Instead, you must connect the TIC call to the TOC call to perform the stopwatch function โ for example, like this:
timerID = tic; %# Start a clock and return the timer ID while true %# Perform some process if(toc(timerID) > RUNTIME) %# Get the elapsed time for the timer break; end end
Alternatively, you can simplify your loop as follows:
while (toc(timerID) < RUNTIME) %
source share