File Exchange

image thumbnail

WORKBAR

version 1.0 (109 KB) by

Efficient and stylish alternative to WAITBAR.

4.73333
15 Ratings

8 Downloads

Updated

No License

WORKBAR Graphically monitors progress of calculations
WORKBAR(X) creates and displays the workbar with the fractional length
"X". It is an alternative to the built-in matlab function WAITBAR,
Featuring:
- Doesn't slow down calculations
- Stylish progress look
- Requires only a single line of code
- Displays time remaining
- Display time complete
- Capable of title and description
- Only one workbar can exist (avoids clutter)

WORKBAR(X, MESSAGE) sets the fractional length of the workbar as well as
setting a message in the workbar window.

WORKBAR(X, MESSAGE, TITLE) sets the fractional length of the workbar,
message and title of the workbar window.

WORKBAR is typically used inside a FOR loop that performs a lengthy
computation. A sample usage is shown below:

for i = 1:10000
% Calculation
workbar(i/10000,'Performing Calclations...','Progress')
end

Another example:

for i = 1:10000
% Calculation
if i < 2000,
workbar(i/10000,'Performing Calclations (Step 1)...','Step 1')
elseif i < 4000
workbar(i/10000,'Performing Calclations (Step 2)...','Step 2')
elseif i < 6000
workbar(i/10000,'Performing Calclations (Step 3)...','Step 3')
elseif i < 8000
workbar(i/10000,'Performing Calclations (Step 4)...','Step 4')
else
workbar(i/10000,'Performing Calclations (Step 5)...','Step 5')
end
end

See also: WAITBAR, TIMEBAR, PROGRESSBAR

Comments and Ratings (15)

Nathan Orloff

I love this function. But it uses the image processing toolbox. I wish it didn't.

Further to ben mitch's comments the latest versions of MATLAB dislike try/catch commands so replacing the two starting on lines 207 and 211 with

if exist('progtitle','var')==0;
progtitle = work.progtitle;
end
if exist('message','var')==0;
message = work.message;
end

seems to work.

Whilst I haven't found it to be a huge amount faster than waitbar the estimated time remaining, and setting it to run only every 5-10% of iterations, makes up for that!

andrey

andrey (view profile)

preventing waitbar from slowing down your calculation:
for i =1:50000
if ((i/100) == floor(i/100))
waitbar(i/all.data.num_of_mol);
end
end

Namshik Han

Simon Robinson

colour match XP scheme. It would be nice to have an Ubuntu theme too.

ebrahim sepidbar

workbar

Mike Russell

With R2006a I do not have 'imshow' available. I am trying to determine why so I can use your progress bar.

Also a fantastic option would be the addition or ability to have a cancel button similar to waitbar.

Jan Huisken

Great! I think this is the best of all! Gives you: time remaining, percentage, and title!

Chanin Kawaokaw

It's Works

Rafy Azman

Very cool!!

Matthias Althoff

ben mitch

much better than my old thing (progbar). couple of issues...

1) in v7 i have my default window style set to docked, so the progress bar gets docked, which looks wrong and is less functional. add line 122

'WindowStyle','normal',...

and 2) you have not turned off handle vis. so i can plot to this figure, which is a shame. i find if i add this at figure creation things get a bit messed up so my quick hack was to add line 191...

set(progfig,'HandleVisibility','off');

which seems to work. you might want to check that though.

nice job. love the XP styling. bet those UNIXers hate hate hate it. :)

Jay Cee

This is very cool - thanks!

Igor Moiseev

Thank you for useful tool.

Updates

Fixed bug with x = 0

Corrected a few minor bugs

MATLAB Release
MATLAB 6.5 (R13)
Acknowledgements

Inspired by: timebar, progressbar

Inspired: Progress Dialog

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

» Watch video