2.5

2.5 | 2 ratings Rate this file 15 Downloads (last 30 days) File Size: 1.79 KB File ID: #23892
image thumbnail

progress bar

by

 

24 Apr 2009 (Updated )

This function print on your command window a handmade progress bar.

| Watch this File

File Information
Description

If you have a time consuming loop, you can measure the time to end with this function. The only thing you have to know is the total number of loops to do.
For instance if you use:
>>for j = 1:10^6
>>statement;
>>progress_bar(j, 10^6);
>>end
you get the same result in screenshot.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
12 Dec 2013 kasim tasdemir

Hi,

I use 'dispstat' function just for this purpose. It can update the previous output which is a missing function of default 'disp'. Very simple to use. It can be downloaded from here:

http://www.mathworks.com/matlabcentral/fileexchange/44673

***Sample usage:
dispstat('','init'); % One time only initialization
dispstat(sprintf('Begining the process...'),'keepthis','timestamp');
for i = 97:100
dispstat(sprintf('Progress %d%%',i),'timestamp');
%doing some heavy stuff here
end
dispstat('Finished.','keepprev');

***Output:
11:25:37 Begining the process...
11:25:37 Progress 100%
Finished.

All the best

12 Dec 2013 kasim tasdemir

Hi,

I use 'dispstat' function just for this purpose. It can update the previous output which is a missing function of default 'disp'. Very simple to use. It can be downloaded from here: http://www.mathworks.com/matlabcentral/fileexchange/44673-overwritable-message-outputs-to-commandline-window

***Sample usage:
dispstat('','init'); % One time only initialization
dispstat(sprintf('Begining the process...'),'keepthis','timestamp');
for i = 97:100
dispstat(sprintf('Progress %d%%',i),'timestamp');
%doing some heavy stuff here
end
dispstat('Finished.','keepprev');

***Output:
11:25:37 Begining the process...
11:25:37 Progress 100%
Finished.

All the best

12 Jan 2010 Rob Campbell

The waitbar can be annoying at times, so I see why this would be a nice function to have. Unfortunately is has to clear the screen to work. Personally, I prefer sticking an fprintf('.') in the loop so that I can see the progress. Simple but effective.

12 May 2009 Jason Kaeding

Why not use built-in waitbar function?

Updates
12 May 2009

A third optional input parameter is added. it is useful if embedding the progress_bar function within another function in order to visualize for instance its name (e.g. see screenshot).

Contact us