Way to tell % complete of script
Show older comments
Is there a way to get an elapsed time or estimated time left or even a percent left of a script that is running?
Accepted Answer
More Answers (2)
David Young
on 17 Aug 2011
If the script is already running, no.
If
- the script has not yet started running
- you can identify the main loop
- each iteration of the loop takes a reasonably consistent length of time
- the total number of iterations of the loop is known in advance
then you can insert a statement in the loop to print out the percentage of iterations complete, or display a progress bar using waitbar. There are examples in
doc waitbar
To get the elapsed time, you can use tic and toc. To get the cpu time used, you can use cputime.
Daniel Shub
on 17 Aug 2011
0 votes
If you have not started the script yet, but want the script to tell you how far you are along once you start it there are a number of submission on the FEX: http://www.mathworks.com/matlabcentral/fileexchange/?term=progress+bar
If the script is already running, then in general you cannot find out where it is. If you have a good idea of what the memory/processor/network profile should look like, then maybe you could inspect those and figure out where you are.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!