cmdWaitBar
cmdWaitBar
Matlab function that displays a progression bar in the command window.
This Matlab function will generate an updating progress bar (waitbar) in the command window.
This is a useful tool during data processing over many iterations or time-cosuming computations.
This simple visual feedback allows to track current progress and may also be a valuable tool for debugging and finding with value/entry may be causing an error.
By using simple text output rather than a graphical interface, the computational sacrifice is minimised, which speeds tasks when compared to other waitbars that have graphical outputs.
The waitbar will adapt to the current width of your command window.
There are 2 viewer modes:
- Waitbar (viewer mode 1 - default): Good for global progression tracking, fast simple, customisable.
- Iteration (viewer mode 2): displays current iteration out of total for detailed view on current progress - good for debugging.
NB: best use is to call the cmdWaitBar function at the start of the for-loop in order to get most accurate information for debugging!
Viewer mode: | Viewer 1 (default - waitbar) | Viewer 2 (Current iteration) |
Example code |
iStart = 1;
iStop = 50000;
for i = iStart:iStop
%(customise with e.g: '-')
cmdWaitBar(iStart,iStop,i)
%[Your code...]
end |
iStart = 1;
iStop = 50000;
for i = iStart:iStop
cmdWaitBar(iStart,iStop,i,2)
%[Your code...]
end |
Command window output |
How to use:
Within a "for" loop in matlab, insert a call to the function with the following three arguments
- iStart, the integer the for-loop starts at
- iStop, the final iterative value
- i, the current iteration's value
Optional arguments that can be passed to the function:
- '(char-of-choice)' for the waitbar. Default is '·', such as [···]. Only the first char in a string will be used when passed to the function as an argument (e.g: '-;' will generate [---]).
- Viewer mode: value 1 or 2. 1 (default) generates the waitbar with a percentage value. 2 generates the current iteration value over iStop (e.g: "Iteration: 72/223").
cmdWaitBar 2022 | Human Neuron Lab - UNIGE | jonathan.monney@unige.ch
Citar como
Jonathan Monney (2024). cmdWaitBar (https://github.com/HumanNeuronLab/cmdWaitBar/releases/tag/v1.0.2), GitHub. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.2.0 | See release notes for this release on GitHub: https://github.com/HumanNeuronLab/cmdWaitBar/releases/tag/v1.0.2 |
||
1.0.1.0 | See release notes for this release on GitHub: https://github.com/HumanNeuronLab/cmdWaitBar/releases/tag/v1.0.1 |
||
1.0.0 |