Timing Code

The function "clock" gives you the current time of day. The data type for this time is an array of numbers representing, the day, month, year, hour, minute, and second. The etime function tells you the elapsed time between a "start time" and an "end time".

	
	  start_time = clock(); % get the original time

	  % DO CODE HERE (call functions, run scripts, etc)

	  elapsed_time = etime(clock(), start_time);

	  fprintf('it took %d seconds\n', elapsed_time);
	
      


Back to Topics List