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! :)
% 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
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:
dispstat('','init'); % One time only initialization
dispstat(sprintf('Begining the process...'),'keepthis','timestamp');
for i = 97:100
%doing some heavy stuff here
11:25:37 Begining the process...
11:25:37 Progress 100%
All the best
Quite usefull. And yes, fun :)
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).
- improved performance