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.
Antonio Jose Cacho
Antonio Cacho (2021). TimedProgressBar (https://www.mathworks.com/matlabcentral/fileexchange/46763-timedprogressbar), MATLAB Central File Exchange. Retrieved .
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.
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)
This is very nice.
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.
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;
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!