Navigation

Operators and Keywords

Function List:

C++ API

Function File: h = waitbar (frac)
Function File: h = waitbar (frac, msg)
Function File: h = waitbar (…, "FigureProperty", "Value", …)
Function File: waitbar (frac)
Function File: waitbar (frac, hwbar)
Function File: waitbar (frac, hwbar, msg)

Return a handle h to a new waitbar object.

The waitbar is filled to fraction frac which must be in the range [0, 1].

The optional message msg is centered and displayed above the waitbar.

The appearance of the waitbar figure window can be configured by passing property/value pairs to the function.

When called with a single input the current waitbar, if it exists, is updated to the new value frac. If there are multiple outstanding waitbars they can be updated individually by passing the handle hwbar of the specific waitbar to modify.

Demonstration 1

The following code

 h = waitbar (0, '0.00%');
 for i = 0:0.01:1
   waitbar (i, h, sprintf ('%.2f%%', 100*i));
 end
 close (h);

gives an example of how 'waitbar' is used.

Demonstration 2

The following code

 h = waitbar (0, 'please wait...');
 for i = 0:0.01:0.6
   waitbar (i);
 end
 i = 0.3;
 waitbar (i, h, 'don''t you hate taking a step backward?');
 pause (0.5);
 for i = i:0.005:0.7
   waitbar (i, h);
 end
 waitbar (i, h, 'or stalling?');
 pause (1);
 for i = i:0.003:0.8
   waitbar (i, h, 'just a little longer now');
 end
 for i = i:0.001:1
   waitbar (i, h, 'please don''t be impatient');
 end
 close (h);

gives an example of how 'waitbar' is used.

Demonstration 3

The following code

 h1 = waitbar (0, 'Waitbar #1');
 h2 = waitbar (0, 'Waitbar #2');
 h2pos = get (h2, 'position');
 h2pos(1) = h2pos(1) + (h2pos(3) + 50);
 set (h2, 'position', h2pos);
 pause (0.5);
 for i = 1:4
   waitbar (i/4, h1);
   pause (0.5);
   waitbar (i/4, h2);
   pause (0.5);
 end
 pause (0.5);
 close (h1);
 close (h2);

gives an example of how 'waitbar' is used.

Package: octave