| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
e = etime(t2, t1)
e = etime(t2, t1) returns the number of seconds between vectors t1 and t2. The two vectors must be six elements long, in the format returned by clock:
T = [Year Month Day Hour Minute Second]
etime does not account for the following:
Leap seconds.
Daylight savings time adjustments.
Differences in time zones.
When timing the duration of an event, use the tic and toc functions instead of clock and etime. clock uses the system time, which might be adjusted periodically by the operating system and thus might not be reliable in time comparison operations.
This example shows two ways to calculate how long a particular FFT operation takes. Using tic and toc is preferred, as it can be more reliable for timing the duration of an event:
x = rand(800000, 1);
t1 = tic; fft(x); toc(t1) % Recommended
Elapsed time is 0.097665 seconds.
t = clock; fft(x); etime(clock, t)
ans =
0.1250
![]() | errordlg | etree | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |