Wednesday, March 11, 2015

Timestamps in Matlab

Matlab has a nifty function for taking timestamps to measure the time it takes to run something. The functions are tic and toc.
You start a timer by calling tic then stop it by calling toc. When toc isn't assigned to a variable, it will print a timestamp summary to the console.
You can save a tic_id to use multiple timers.
Here is a simple example that uses the timer ID:

t_id = tic;
your_time_consuming_function();
toc(t_id)

No comments:

Post a Comment