How to calculate execution time in Matlab?

조회 수: 2 (최근 30일)
Sihem
Sihem 2022년 7월 30일
댓글: Sihem 2022년 7월 30일
#Help_Please
Hello, hope that you're in a good health
I have 2 heuristics and i want to calculate the execution time for each instance, what's the right instruction to do it?

채택된 답변

Jan
Jan 2022년 7월 30일
The direct method:
tic
x = sin(rand(1e4, 1e4));
toc
Elapsed time is 1.294872 seconds.
The smart method:
timeit(@() sin(rand(1e4, 1e4)))
ans = 1.2593

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by