File Exchange

image thumbnail


version 1.1 (5.54 KB) by

Console progress bar for long-running operations



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


Comments and Ratings (5)

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.

kasim tasdemir


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


Peter (view profile)

Quite usefull. And yes, fun :)

Yair Altman

Yair Altman (view profile)

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
MATLAB 7.8 (R2009a)

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

» Watch video