File Exchange

image thumbnail


version (5.54 KB) by Evgeny Pr
Console progress bar for long-running operations

1 Download

Updated 05 Feb 2011

View License

This class creates a console progress bar (status bar) for long-running operations. Visually, it's very similar to the unix command line utilites "pv" and "wget". You can customize the look to your taste.

In addition, it's funny, but it may be useful. Just for fun! :)

Usage example:
% Create Instance
cpb = ConsoleProgressBar();

% Set progress bar parameters
cpb.setLeftMargin(1); % progress bar left margin
cpb.setTopMargin(1); % rows margin

cpb.setLength(40); % progress bar length: [.....]
cpb.setMinimum(0); % minimum value of progress range [min max]
cpb.setMaximum(100); % maximum value of progress range [min max]


for k = 0:100
userText = sprintf('Progress: [%d/%d]', k, 100);

cpb.setValue(k); % update progress value
cpb.setText(userText) % update user text



Cite As

Evgeny Pr (2020). ConsoleProgressBar (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

I haven't decided whether I should really be using this or writing to a log file, but it worked as described and the code is well-written. The demo was quite helpful, too.


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:

***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

11:25:37 Begining the process...
11:25:37 Progress 100%

All the best


Quite usefull. And yes, fun :)

Yair Altman

Well documented, well written, clean and tidy code, useful utility.

Nice and simple example of using Matlab's Object-Oriented programming (good separation of public and private properties/methods, for example).

Pi Ting



- improved performance
- fixed minor bugs

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