I am trying to modify this code
h = waitbar(0,'Please wait...');
for i=1:10, % computation here % waitbar(i/10) end
close(h)
How can I divide waitbar in 10 steps . I mean it should look like
-------------------
| | | | | | | | | |
-------------------
The following code will allow you to add vertical lines to your waitbar:
After running the above code and then doing
waitbar(0.35,hWait);, you will see a figure like this:NOTE: The black lines in the plot (both the vertical lines I added and the already existing box around the progress bar) will intermittently appear above or below the red progress bar when it is updated. This seems like an existing bug with how WAITBAR behaves, and I have yet to find a workaround to correct it. However, there are quite a number of alternatives that can be found on the MathWorks File Exchange, so I’d certainly check those out if the built-in function doesn’t do it for ya. 😉