Output the amount of time it took to run a simulation
1 回表示 (過去 30 日間)
古いコメントを表示
My simulations take a long time. I would like to be able to measure the amount of time it took for a simulation to run. I would like to be able to do this even if I prematurely stop the run.
0 件のコメント
回答 (2 件)
Walter Roberson
2021 年 11 月 25 日
Put the code to be timed into a function. At the beginning of the function, tic() and assign the result to a variable. Then immediately create an onCleanup that does a toc() of the variable and outputs the result.
If you do this then the time will be output when the function exits, including cases where the function was interrupted.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!