View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Display Time-Remaining in a Loop v2.1

4.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 3.76 KB File ID: #30512 Version: 1.2

Display Time-Remaining in a Loop v2.1



23 Feb 2011 (Updated )

Simple yet robust script that displays the time remaining for a loop to complete all its iterations.

| Watch this File

File Information

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.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
28 Feb 2011 Darren Price

... by the way the tic now goes inside the loop, rather than before it.

Comment only
28 Feb 2011 Darren Price

Version 2 is now available. I have implemented all the functions suggested previously and more... Enjoy! :)

Comment only
24 Feb 2011 Darren Price

Hi Folks! Thanks for the feedback. I can put the skip and increment feature in quite easily (i think). Will update the file asap.

Comment only
23 Feb 2011 Sean de

Sean de (view profile)

*Typo above:
"No option to display only occasionally (like a skip)"

Comment only
23 Feb 2011 Sean de

Sean de (view profile)

Nice work:
-Good help
-Works pretty well with any integer increment in for-loop, but not fractions.
e.g. for ii = 1:.2:10

-No H1 line :(
-No option to display only one every 10 (like a skip) e.g:
for ii = 1:100
if ~mod(ii,5)
%Negative Time!

27 Feb 2011 1.1

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.

10 Mar 2011 1.2

There was a risk of clearing all global variables from memory under certain circumstances. This is now solved.

Contact us