In short: A intuitive matlab progressbar class aimed for interfacing different view frontends with same intuitive usage.
- Same control interfaces supporting different progressbar view.
- (CLI) JAAdrian's MatlabProgressBar support.
- (GUI) Matlab uiprogressdlg support.
- Warning features for calling mismatch (e.g. maximum value of loop not reached).
- Parallel loop support.
- Nested loop support.
- Unit testing for ensuring code behavior and quality.
- Robust ETA (for GUI).
- Add parameters to control and reduce the display refresh frequency.
- Automatically start a new GUI window when it is closed unexpectedly.
- Clone the repository.
- Load the matlab project file
matlab-progressbar-collection.prj
. - Use class
ProgressbarCollection()
to manage the progressbar.
- Setup your own project in Matlab.
- Clone this reposity somewhere in your project. (or add as submodule, if you also use git in your project)
- Reference this project in your project files.
See files in examples folder. Some important usage is listed below.
Simple loop example
progressbar = ProgressbarCollection();
nMax = 100
progressbar.setProgressMaximum(1, nMax, 'Doing some tasks')
for iMax = 1:nMax
pause(0.05)
progressbar.stepProgress(1)
end
progressbar.finishProgress(1)
delete(progressbar)
Indeterminate example
progressbar = ProgressbarCollection();
progressbar.setProgressMaximum(1, 0, "Don't know how much tasks we have")
pause(1)
progressbar.stepProgress(1, 0, 'Doing task 1 ...')
pause(1)
progressbar.stepProgress(1, 0, 'Doing task 2 ...')
pause(1)
progressbar.stepProgress(1, 0, 'Doing task 3 ...')
pause(1)
progressbar.finishProgress(1)
delete(progressbar)
Multiple level example (GIF not updated for ETA)
progressbar = ProgressbarCollection();
nMax = 10
nMax2 = 10
progressbar.setProgressMaximum(1, nMax, 'Task level 1')
for iMax = 1:nMax
progressbar.setProgressMaximum(2, nMax2, 'Task level 2')
for iMax2 = 1:nMax2
pause(0.1)
progressbar.stepProgress(2)
end
progressbar.finishProgress(2)
progressbar.stepProgress(1)
end
progressbar.finishProgress(1)
delete(progressbar)
Unit tests are used for behaviour and quality support. It could be also worked as some kind of documentation since it is recording the expected behaviour.
If you would like to run it locally for some reason, after loading the project, you can either use project GUI, Code Quality Dashboard or type the command:
runtests
to run the unit tests.
tbd
MIT License
Copyright (c) 2024 Haowen Yao
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.