loopCount(i,n)
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 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |