开源软件名称(OpenSource Name):JAAdrian/MatlabProgressBar开源软件地址(OpenSource Url):https://github.com/JAAdrian/MatlabProgressBar开源编程语言(OpenSource Language):MATLAB 100.0%开源软件介绍(OpenSource Introduction):MatlabProgressBarThis project hosts the source code to the original MATLAB FileExchange project and is place of active development. A drawback in MATLAB's own A design target was to mimic the best features of the progress bar tqdm for Python. Thus, this project features a Unicode-based bar and some numeric information about the current progress and the average iterations per second. Several projects exist on MATLAB's File Exchange but none incorporates the feature set shown below. That's why I decided to start this project. Supported features include (or are planned):
Note: DependenciesNo dependencies to toolboxes. The code has been tested with MATLAB R2016a, R2016b and R2020b on Windows 10, Xubuntu 16.04.2 LTS and Linux Mint 20. InstallationPut the files UsageDetailed information and examples about all features of Proposed Usage for Simple LoopsThe simplest use in See the example below: numIterations = 10e3;
% create the loop using the progress() class
for iIteration = progress(1:numIterations)
% do some processing
end Extended Usage with all FeaturesThe basic work flow is to instantiate a All settings are done using name-value pairs in the constructor. It is strongly encouraged to call the object's Usage A simple but quite common example looks like this: numIterations = 10e3;
% instantiate an object with an optional title and an update
% rate of 5 Hz, i.e. 5 bar updates per seconds, to save
% printing load.
progBar = ProgressBar(...
numIterations, ...
'Title', 'Awesome Computation' ...
);
% begin the actual loop and update the object's progress
% state
for iIteration = 1:numIterations
%%% do some processing here
% ...
progBar([], [], []);
% or in releases <= R2015b
% progBar.step([], [], []);
end
% call the 'release()' method to clean up
progBar.release(); Parallel Toolbox SupportIf you use MATLAB's Parallel Computing Toolbox, refer to the following example or the demo file numIterations = 10e3;
% Instantiate the object with the 'IsParallel' switch set to true
progBar = ProgressBar(numIterations, ...
'IsParallel', true, ...
'Title', 'Parallel Processing' ...
);
% ALWAYS CALL THE SETUP() METHOD FIRST!!!
progBar.setup([], [], []);
parfor iIteration = 1:numIterations
pause(0.1);
% USE THIS FUNCTION AND NOT THE STEP() METHOD OF THE OBJECT!!!
updateParallel([], pwd);
end
progBar.release(); Known IssuesFlickering Bar or Flooding of the Command WindowMATLAB's speed to print to the command window is actually pretty low. If the update rate of the progress bar is high the mentioned effects can occur. Try to reduce the update rate from the default 5 Hz to something lower (say 3 Hz) with the The Bar Gets Longer With Each IterationThere seems to be a problem with the default font If you do not want to or cannot change the font in the setting, you can set the class's For convenience, this property can also be set in the Thanks @GenosseFlosse for the fix! Strange Symbols in the Progress BarThe display of the updating progress bar is highly dependent on the font you use in the command window. Be sure to use a proper font that can handle Unicode characters. Otherwise be sure to always use the Remaining Timer Objects in MATLAB's BackgroundSometimes, if the user cancels a loop in which a progress bar was used, the destructor is not called properly and the timer object remains in memory. This can lead to strange behavior of the next progress bar instantiated because it thinks it is nested. If you encounter strange behavior like wrong line breaks or disappearing progress bars after the bar has finished, just call the following static method to delete all remaining timer objects in memory which belong(ed) to progress bars and start over. ProgressBar.deleteAllTimers(); Issues Concerning Parallel ProcessingThe work-flow when using the progress bar in a parallel setup is to instantiate the object with the
TL/DR: Unit TestsYou can run all available tests in the project directory by navigating into the runtests Tag NonParallel LicenseThe code is licensed under BSD 3-Clause as stated in the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论