Skip to content

Commit efda63b

Browse files
Update cmdWaitBar.html
1 parent cedae6e commit efda63b

1 file changed

Lines changed: 104 additions & 1 deletion

File tree

pages/Fun things/cmdWaitBar.html

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,104 @@
1-
[Coming soon]
1+
<h2 align="center">cmdWaitBar</h2>
2+
3+
<h3><a href="https://github.com/HumanNeuronLab/cmdWaitBar/releases"><img src="https://img.shields.io/badge/v1.0.2-23%C2%B7Jan%C2%B72023-blue?logo=github" width="150" align="right"/></a><div align="left"><i>Matlab function that displays a progression bar in the command window.</i></div></h3>
4+
5+
---
6+
7+
This Matlab function will generate an updating progress bar (waitbar) in the command window.
8+
9+
This is a useful tool during data processing over many iterations or time-cosuming computations.
10+
11+
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.
12+
13+
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.
14+
15+
The waitbar will adapt to the current width of your command window.
16+
17+
[![View cmdWaitBar on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://ch.mathworks.com/matlabcentral/fileexchange/122357-cmdwaitbar)
18+
19+
---
20+
21+
<br>
22+
23+
There are 2 viewer modes:
24+
25+
- Waitbar (viewer mode 1 - default): Good for global progression tracking, fast simple, customisable.
26+
- Iteration (viewer mode 2): displays current iteration out of total for detailed view on current progress - good for debugging.
27+
28+
> 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!
29+
<br>
30+
31+
<table>
32+
<tr>
33+
<td> Viewer mode: </td> <td> Viewer 1 (default - waitbar) </td> <td> Viewer 2 (Current iteration) </td>
34+
</tr>
35+
<tr>
36+
<td> Example code </td>
37+
<td>
38+
39+
```matlab
40+
iStart = 1;
41+
iStop = 50000;
42+
for i = iStart:iStop
43+
44+
%(customise with e.g: '-')
45+
cmdWaitBar(iStart,iStop,i)
46+
47+
%[Your code...]
48+
end
49+
```
50+
51+
</td>
52+
<td>
53+
54+
```matlab
55+
iStart = 1;
56+
iStop = 50000;
57+
for i = iStart:iStop
58+
59+
cmdWaitBar(iStart,iStop,i,2)
60+
61+
%[Your code...]
62+
end
63+
```
64+
65+
</td>
66+
</tr>
67+
<tr>
68+
<td> Command window output </td>
69+
<td>
70+
71+
![Alt Text](https://github.com/jonathanmonney/misc_assets/blob/main/cmdWaitBar/viewer1.gif)
72+
73+
</td>
74+
<td>
75+
76+
![Alt Text](https://github.com/jonathanmonney/misc_assets/blob/main/cmdWaitBar/viewer2.gif)
77+
78+
</td>
79+
</tr>
80+
</table>
81+
<br><br>
82+
83+
### How to use:
84+
85+
**Within a "for" loop in matlab, insert a call to the function with the following three arguments**
86+
- iStart, the integer the for-loop starts at
87+
- iStop, the final iterative value
88+
- i, the current iteration's value
89+
90+
**Optional arguments that can be passed to the function:**
91+
- '(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 [---]).
92+
- 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").
93+
<br><br>
94+
95+
96+
---
97+
98+
<p align="center"> <b><u>cmdWaitBar</u></b> 2022
99+
| <a href="https://www.unige.ch/medecine/neucli/en/groupes-de-recherche/1034megevand/">Human Neuron Lab</a> - UNIGE
100+
| <a href="mailto:jonathan.monney@unige.ch">jonathan.monney@unige.ch</a></p>
101+
<br>
102+
<div align="center"><a href="https://www.unige.ch/medecine/neucli/en/groupes-de-recherche/1034megevand/">
103+
<img src="https://raw.githubusercontent.com/HumanNeuronLab/ERWiN/main/assets/UNIGE_logo.png" width="200"/>
104+
</a></div>

0 commit comments

Comments
 (0)