Function progress_bar

Function Documentation

function progress_bar(input, varargin)

Display a progress bar inside the command window of the type:

100% [====================] Completed!

Usage:

  • progress(‘_start’): initializes a new progress bar. Must always be called first.

  • progress(i): updates the progress bar. i is a percentage.

  • progress(i, m): is similar, but a percentage is automagically calculated, where i is the current step and m the maximum number of steps.

  • progress(‘_end’): ends the progress bar.

  • progress(‘_erase’): ends the progress bar and removes if from the command window, restoring it to the way it was before the progress bar was initiated.

  • progress(message): ends the progress bar and adds message after the bar.

  • progress(…, opts): uses options from the opts struct.

Parameters
  • [optional] – opts.percentage_length: sets the number of characters reserved for the percentage display (default: 5)

  • [optional] – opts.bar_length: sets the number of characters reserved for the progress bar (default: 20)

  • [optional] – opts.char_empty: sets the “empty” character (default: ‘ ‘)

  • [optional] – opts.char_filled: sets the “filled” character (default: ‘=’)

Returns

out The output progress bar string.