View License

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

» Watch video

Highlights from

4.6 | 16 ratings Rate this file 10 Downloads (last 30 days) File Size: 4.09 KB File ID: #1255 Version: 1.0
image thumbnail



Chad English (view profile)


18 Jan 2002 (Updated )

Similar to waitbar, but with estimated time remaining and progress percentage.

| Watch this File

File Information

TIMEBAR is a progress window, similar to waitbar, that shows the progress of calculations using a sliding bar, a displayed percentage complete, and an estimated time remaining.

The estimated time remaining is calculated linearly using only the initialized time, the current time, and the percent progress. It assumes a constant rate of progress.

The user can also define a displayed message (e.g., to indicate what process is being monitored) as well as a window title.


This file inspired Tactics Toolbox, Multibar, and Workbar.

MATLAB release MATLAB 6.0 (R12)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
28 Feb 2013 Raz Shimoni

Very useful.

12 Jul 2012 Francesco Montorsi

Very nice function!
Note however there is a typo, at line 29, in the comments containing an example to run, it should be "timebar(h,i/100)" instead of "timebar(h,1/100)", otherwise the progress signaled to the timebar is always 1/100 instead of proceeding toward 100 :)

24 Oct 2011 Mingzhi

16 Jun 2011 Michael St.

Good Work.
To speed up code by factor ~50:

comment line 137: pause(10e-100)
go after line 139: h=message;
insert: figure(h);

14 Mar 2011 Wei

Wei (view profile)

Nice. It is exactly the function that I am looking for. Thanks.

02 Jan 2010 John D'Errico

John D'Errico (view profile)

I've tried it a few times. Nice help. I like the time remaining counter. It works nicely, but with a flaw. You don't realize how much time is being used by the timebar updates. Do a simple comparison. Here I'll write a loop that does nothing but sum the integers from 1 to 1000. It should run VERY quickly.

n = 1000;
s = 0;
for i = 1:n,
s = s + i;

Elapsed time is 0.003069 seconds.

Now put in a timebar.

h = timebar('fgfg','fhhth');
n = 1000;
for i = 1:n,
s = s + i;

Elapsed time is 1.344795 seconds.

See that with a timebar generated, it took a loop that should terminate in virtually NO time at all, and wasted 99.8% of the time just to do a timebar.

So be careful if you have a really big loop, with hugely many iterations. You might be surprised at how much more quickly it will run without any timebar at all. The place to use this code is when you have a loop where each pass through the loop is intensive, but with perhaps at most a few hundred iterations of the loop. Otherwise you will be disappointed.

13 May 2008 Christal Hu

Hi, may i know how to integrate this bar into GUI which does audio file playing? I'm thinking of knowing how much time elapsed n progress in the audio file, similiar to window media player. Thank you!

10 Nov 2006 Metin S

Works great.. Only 3 lines of code to get it to work..

09 Aug 2006 nadia a

This progress bar is great! It really helps improving my GUI. It would be better if there is a Cancel button included in case user attempts to stop the process. Thanks a lot! I'll be using it for my masters research and I'll quote you as the source :)

22 May 2004 shoa jakson

better than waitebar

14 May 2004 Ali Ozgun Ok

Nice bar!!! thanks...

21 Apr 2004 Ryan O'Hara

This bar is discernible decrease in computuational speed was really seen. Now I know whether to go get a cup of coffee or got to lunch!

08 Oct 2003 Rogério Paulo Rodrigues

Excellent, I use this for large files compilations. It gives you the idea of how much time it still miss and if the computer is blocked or not.

29 Apr 2003 Lei Wang

Very useful. It can show both time and progress information!

29 Nov 2002 Fabio Murra

The bar is pretty neat but it slows calculations incredibly even at very small update rates

26 Nov 2002 Christian Ribe

Nice just what i was looking for!
Thanks Chad.

11 Mar 2002

Added an update rate option, with a default of 0.1 seconds.

Contact us