ETA_disp

Version 2.0.0.0 (22.6 KB) by Rik
Display the estimated time of completion of a looping process
7 Downloads
Updated 3 Nov 2023

ETA_disp documentation

View ifversion on File Exchange Open in MATLAB Online

Table of contents

Description

This function will print a short message to the command window, giving you an idea when a process might finish. It displays the current percentage done, the runtime until now, the estimated time of completion, the time per iteration (or iterations per second), and the number of iterations left.

Alternatively you can capture the text before it is printed and use the text in your own application, e.g. in a GUI.

Matlab/Octave

Syntax

ETA_disp(N_total,n,then)
ETA_disp(N_total,n,then,per_it_display)
ETA_disp(N_total,n,then,per_it_display,scale_estimate)
msg = ETA_disp(___)
[msg,strct] = ETA_disp(___)

Output arguments

Argument Description
msg
strct

Input arguments

Argument Description
N_total The total number of iterations.
n The current count of iterations (this will be adjusted up to eps if 0).
then This should be the value the now function returned before the loop began.
per_it_display (optional, default is 0) if set to -1, the function displays the time per iteration on the last line. Setting to 1 will print iterations per seconds on the last line. With 0 the choice will be made automatically.
scale_estimate The time remaining is multiplied by this factor (this doesn't change the rate calculated over the processed iterations). This allows skewing the estimate in cases where the earlier iterations are expected to be faster.

Examples

N = 10;then = now; %#ok<TNOW1>
for n=1:N
    pause((1+rand)*2/N)
    ETA_disp(N,n,then)
end

N = 10^6;then = now; %#ok<TNOW1>
for n=1:N
    pause((1+rand)*2/N)
    if mod(n,10^4)==0 % Avoid spending too much time printing the ETA.
        ETA_disp(N,n,then,1) % Print iterations/sec instead of sec/iteration.
    end
end

Compatibility, version info, and licence

Compatibility considerations:

  • This is expected to work on all releases.
Test suite result Windows Linux MacOS
Matlab R2023b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2023a W11 : Pass
Matlab R2022b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2022a W11 : Pass
Matlab R2021b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2021a W11 : Pass
Matlab R2020b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2020a W11 : Pass
Matlab R2019b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2019a W11 : Pass
Matlab R2018a W11 : Pass ubuntu_22.04 : Pass
Matlab R2017b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2016b W11 : Pass ubuntu_22.04 : Pass Monterey : Pass
Matlab R2015a W11 : Pass ubuntu_22.04 : Pass
Matlab R2013b W11 : Pass
Matlab R2007b W11 : Pass
Matlab 6.5 (R13) W11 : Pass
Octave 8.2.0 W11 : Pass
Octave 7.2.0 W11 : Pass
Octave 6.2.0 W11 : Pass raspbian_11 : Pass Catalina : Pass
Octave 5.2.0 W11 : Pass
Octave 4.4.1 W11 : Pass Catalina : Pass
Version: 2.0.0
Date:    2023-11-03
Author:  H.J. Wisselink
Licence: CC by-nc-sa 4.0 ( https://creativecommons.org/licenses/by-nc-sa/4.0 )
Email = 'h_j_wisselink*alumnus_utwente_nl';
Real_email = regexprep(Email,{'*','_'},{'@','.'})

Test suite

The tester is included so you can test if your own modifications would introduce any bugs. These tests form the basis for the compatibility table above. Note that functions may be different between the tester version and the normal function. Make sure to apply any modifications to both.

Cite As

Rik (2024). ETA_disp (https://github.com/thrynae/ETA_disp/releases/tag/v2.0.0), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with R13SP1 and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
2.0.0.0

See release notes for this release on GitHub: https://github.com/thrynae/ETA_disp/releases/tag/v2.0.0

1.2.0

See release notes for this release on GitHub: https://github.com/thrynae/ETA_disp/releases/tag/v1.2.0

1.1

See release notes for this release on GitHub: https://github.com/thrynae/ETA_disp/releases/tag/v1.1

1.0.1

See release notes for this release on GitHub: https://github.com/thrynae/ETA_disp/releases/tag/1.0.1

1.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.