ECG-Kit 1.0

File: <base>/common/progress_bar_ex.m (1,121 bytes)
%% A progress bar class example
%
% Example:

%% start of algorithm
clear

pb = progress_bar('Progress bar demo', 'Start of algorithm');

pause(2)

%% initialization code

pb = pb.checkpoint('Initialization');

pause(4)

%% some iteration known a priori

pb.Loops2Do = 10;
pb.Title = 'Iterations known a priori';

for ii = 1:10
    
    pb = pb.start_loop();

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 1');

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 2');

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 3');

    pause(3+randn(1))
    
    pb = pb.end_loop();
    
end

%% some iteration unknown a priori

pb = pb.reset();
pb.Title = 'Iterations Unknown a priori';

for ii = 1:round(8+2*rand(1))
    
    pb = pb.start_loop();

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 1');

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 2');

    pause(3+randn(1))
    
    pb = pb.checkpoint('Step 3');

    pause(3+randn(1))
    
    pb = pb.end_loop();
    
end

%this clear and close all.
clear pb