Progressdisp: A Progress Bar for MATLAB Loops

版本 1.1.0 (3.1 KB) 作者: Hiroto Imamura
: A class to display the progress of a for-loop in the MATLAB command prompt.
45.0 次下载
更新时间 2025/2/11

查看许可证

Progressdisp is a lightweight and efficient MATLAB class designed to provide real-time progress updates for for-loops directly in the command prompt. It supports two primary display modes:
  • Progress Bar ("bar") – A graphical bar that fills as the loop progresses.
  • Text Counter ("str") – A simple message indicating the current iteration out of the total.
In addition to these features, Progressdisp now includes two methods for displaying custom text messages above the progress display:
  • Disp(input_string): Displays a custom message above the progress output without removing the current progress.
  • Disp_over(input_string): Overwrites any existing top text with a new message, ensuring that only the latest information is shown.
These enhancements provide extra context (such as status updates or error messages) while still keeping track of loop progress in a clean and uncluttered command prompt.
Usage Example:
Displayer = Progressdisp(300, BarOrStr="bar"); % Initialize
for i = 1:300
Displayer.Display_progress(i); % Update progress dynamically
pause(0.01); % Simulate processing
end
Examples using Disp or Disp_over
Displayer = Progressdisp(300, barWidth=40, BarOrStr="bar");
for i = 1:300
Displayer.Display_progress(i);
pause(0.01); % Simulate work
% Display texts above the progress bar (every 20 loops)
if mod(i,20)==0
input_string=append("Custom string at loop: ",num2str(i));
Displayer.Disp_over(input_string)
% optionally
% Displayer.Disp(input_string)
end
end

引用格式

Hiroto Imamura (2025). Progressdisp (https://www.mathworks.com/matlabcentral/fileexchange/<...>), MATLAB Central File Exchange. Retrieved February 10, 2025.

MATLAB 版本兼容性
创建方式 R2022b
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签
版本 已发布 发行说明
1.1.0

Included Disp and Disp_over functionality

1.0.1

Minor fixes

1.0.0