Display Time-Remaining in a Loop v2.1
Updated 10 Mar 2011
If you are tired of waiting for loops to finish, not knowing whether you have enough time to go and get lunch, or a nice cup of tea, then your problems are solved :)
This function will display the time left (as a string or vector) in Hrs Mins Secs until the current loop completes all its iterations. All you need to do is put a "tic" command at the start of the loop, and add the function to the end of the loop (before the end command).
Basic configuration options include optional text output, vector output or both.
** New features include: multiple nested loops, loop naming, skip loops, automatic reset, non integer for loops (i.e., for i = 1:0.1:10) supported, non linear or disordered for loops (i.e., for i = [1 5 7 3 5] ) supported.
Extensive help and many examples now included in H1. Type "help dispTimeLeft".
The script works on the assumption that your loops are going to take roughly similar amounts of time to complete.
This file is released with a BSD licence.
Darren Price (2023). Display Time-Remaining in a Loop v2.1 (https://www.mathworks.com/matlabcentral/fileexchange/30512-display-time-remaining-in-a-loop-v2-1), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
There was a risk of clearing all global variables from memory under certain circumstances. This is now solved.
New features include: multiple nested loops supported, loop naming, display every N number of loops supported, automatic reset for globals, non integer 'for loops' supported, non linear for loops i.e., for i = [1 5 7 3 5] supported.