Code covered by the BSD License  

Highlights from
ConsoleProgressBar

5.0

5.0 | 3 ratings Rate this file 17 Downloads (last 30 days) File Size: 5.54 KB File ID: #30297
image thumbnail

ConsoleProgressBar

by

 

04 Feb 2011 (Updated )

Console progress bar for long-running operations

| Watch this File

File Information
Description

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]

cpb.start();

for k = 0:100
    userText = sprintf('Progress: [%d/%d]', k, 100);
    
    cpb.setValue(k); % update progress value
    cpb.setText(userText) % update user text
    
    pause(0.025)
end

cpb.stop();

Acknowledgements

This file inspired Ecopathlite: A Matlab Based Implementation Of Ecopath.

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

25 Oct 2012 Peter

Quite usefull. And yes, fun :)

23 Apr 2012 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).

15 Feb 2011 Pi Ting

interesting

Updates
05 Feb 2011

- improved performance
- fixed minor bugs

Contact us