- https://www.mathworks.com/help/matlab/ref/timeit.html
- https://www.mathworks.com/help/matlab/matlab_prog/measure-performance-of-your-program.html
tic toc value problem
2 ビュー (過去 30 日間)
古いコメントを表示
hi all in my project i use the tic toc to find the time execution for my project m-file but when run the program one time the result is a value and when run program second ,third time for same m file the value is different.
any value is true the first run value or the second,third run value??
0 件のコメント
回答 (1 件)
Shuba Nandini
2024 年 12 月 24 日
Hi,
I understand you are observing different tic toc values while you are trying to measure the performance of your code. The execution time can be influenced by the current load on your computer's CPU and memory.
As per MathWorks documentation for measuring performance, it states: "Unless you are trying to measure first-time cost, run your code multiple times. Use the timeit function".
In order to perform a robust measurement, try using "timeit" function. It calls the specified function multiple times and returns the median of the measurements.
For more information on "timeit" function and performance measurement, please refer to the following MathWorks documentation:
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Performance and Memory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!