loopCount(i,n)

版本 1.0.0.0 (2.2 KB) 作者: Jody Muelaner
Simple command line progress information for “for” loops
20.0 次下载
更新时间 2018/6/26

查看许可证

Displays progress information for “for” loops at the command window.
Takes inputs: i is current iteration and n is total number of iterations
NOTE: Call tic before loop and loopCount(i,n) before loop end
• Displays the current iteration out of the total to command window
• Also displays the time elapsed and time remaining.
• Times given in seconds, minutes or hours to aid clarity
• Gives update every 5 seconds
EXAMPLE:
>> n=3; w=6; tic;
>> for i=1:n
>> pause(w);
>> loopCount(i,n);
>> end
Outputs on the command line:
Completed iteration 1 of 3
. Time elapsed: 6 seconds. Time remaining: 12 seconds
Completed iteration 2 of 3
. Time elapsed: 12 seconds. Time remaining: 6 seconds
Completed all 3 iterations in 18 seconds

引用格式

Jody Muelaner (2024). loopCount(i,n) (https://www.mathworks.com/matlabcentral/fileexchange/67842-loopcount-i-n), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Loops and Conditional Statements 的更多信息
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0