File Exchange

image thumbnail

TimedProgressBar

version 1.0.0.0 (3.82 KB) by Antonio Cacho
A timed progress bar for concurrent code

1 Download

Updated 28 May 2014

View License

A progress bar for concurrent code, amenable to parfor and other loop constructs.
It uses the command-line, since it appears that Matlab still misses a gui concurrent version of waitbar.
It posts a forecast for the remaining computing time.
Accepts user strings for documenting the computing progress.
It was built on top of Stefan Doerr's ProgressBar and Jeremy Scheff's parfor_progress.
Enjoy,
Antonio Jose Cacho
ajcsccacho@gmail.com

Cite As

Antonio Cacho (2021). TimedProgressBar (https://www.mathworks.com/matlabcentral/fileexchange/46763-timedprogressbar), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

Benedikt Brandt

Rashmi

Antonio Cacho

Daniel
Thank you for your interest and your suggestions. Obviously you are right about the the bare naming of p.
By the way, the command-line is better accessed in a non-concurrent way, due to its very linear nature. The TimedProgressBar is made with this in mind, therefore the explicit warning you can find in these posts regarding eventual concurrent accesses to the command-line, which could result in the rather strange mess you refer to.
About the benefit of printing the elapsed run time against the value of a concise/uncluttered user interface, the balance and trade-offs depend on the application context. One should fiddle with the code to combine elapse and forecasted time in the output, which could become a little long, occupying the space of the progress bar.
And it could be somewhat redundant, regarding the data already posted at each iteration. This data allows one to compute the elapsed run time.
In the end the overall runtime is posted to allow the user to get a summary of the run.

Daniel

oh and not to forget: The remaining time computed is a great feature, but:
It can - for reasons within my code - be inaccurate at times. Therefore it would be nice to also see the time passed since starting.
(which I cannot display any longer by myself, see previous comment)
Cheers

Daniel

This is very nice.
Thanks.

Two remarks:
it uses the variable p to save progress. This is in my code and in many others probably already assigned and thus causes a problem that might be overlooked easily. So I renamed p to Progress everywhere

second, if I already display other output information after each loop iteration, the two outputs conflict with each other and cause some strange displaying. Don't really understand why.

Antonio Cacho

The bar, renders as: [===> ].
It occupies only the right side of the output line, preceded by the forecast of the time to finish.
This forecast is updated each iteration. It is prefixed and post-fixed by text strings. These currently are set at creation time, but can as well be made changeable each iteration.
Besides the mentioned prefix/postfix strings, any other output to the command line, should be delayed until finishing the progress bar, otherwise the command-line would become messy.
The command-line looks like this:

(... previous outputs ...)

Wait for 029:37:08.51, done 41% [====> ]

As seen, in the current version it supports several days long computations.

However, the code is made to be tuned to:
* more compact output;
* changing the text output every iteration;
* etc.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!