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태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!