Back to the main page.

Bug 1406 - ft_progress could print the progress in place, rather than use newlines

Status CLOSED FIXED
Reported 2012-04-03 10:21:00 +0200
Modified 2012-08-23 10:35:13 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 enhancement
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Eelke Spaak - 2012-04-03 10:21:00 +0200

Currently, the following test script (taken from ft_progress documentation): ft_progress('init', 'etf', 'Please wait...'); for i=1:42 ft_progress(i/42, 'Processing event %d from %d', i, 42); pause(0.1); end ft_progress('close') prints the following: Processing event 1 from 42 - estimated time to finish is Inf seconds Processing event 2 from 42 - estimated time to finish is 15 seconds Processing event 3 from 42 - estimated time to finish is 9 seconds Processing event 4 from 42 - estimated time to finish is 7 seconds Processing event 5 from 42 - estimated time to finish is 6 seconds Processing event 6 from 42 - estimated time to finish is 6 seconds Processing event 7 from 42 - estimated time to finish is 5 seconds Processing event 8 from 42 - estimated time to finish is 5 seconds Processing event 9 from 42 - estimated time to finish is 4 seconds Processing event 10 from 42 - estimated time to finish is 4 seconds Processing event 11 from 42 - estimated time to finish is 4 seconds Processing event 12 from 42 - estimated time to finish is 4 seconds Processing event 13 from 42 - estimated time to finish is 4 seconds Processing event 14 from 42 - estimated time to finish is 3 seconds Processing event 15 from 42 - estimated time to finish is 3 seconds Processing event 16 from 42 - estimated time to finish is 3 seconds Processing event 17 from 42 - estimated time to finish is 3 seconds Processing event 18 from 42 - estimated time to finish is 3 seconds Processing event 19 from 42 - estimated time to finish is 3 seconds Processing event 20 from 42 - estimated time to finish is 3 seconds Processing event 21 from 42 - estimated time to finish is 2 seconds Processing event 22 from 42 - estimated time to finish is 2 seconds Processing event 23 from 42 - estimated time to finish is 2 seconds Processing event 24 from 42 - estimated time to finish is 2 seconds Processing event 25 from 42 - estimated time to finish is 2 seconds Processing event 26 from 42 - estimated time to finish is 2 seconds Processing event 27 from 42 - estimated time to finish is 2 seconds Processing event 28 from 42 - estimated time to finish is 2 seconds Processing event 29 from 42 - estimated time to finish is 1 seconds Processing event 30 from 42 - estimated time to finish is 1 seconds Processing event 31 from 42 - estimated time to finish is 1 seconds Processing event 32 from 42 - estimated time to finish is 1 seconds Processing event 33 from 42 - estimated time to finish is 1 seconds Processing event 34 from 42 - estimated time to finish is 1 seconds Processing event 35 from 42 - estimated time to finish is 1 seconds Processing event 36 from 42 - estimated time to finish is 1 seconds Processing event 37 from 42 - estimated time to finish is 1 seconds Processing event 38 from 42 - estimated time to finish is 0 seconds Processing event 39 from 42 - estimated time to finish is 0 seconds Processing event 40 from 42 - estimated time to finish is 0 seconds Processing event 41 from 42 - estimated time to finish is 0 seconds Processing event 42 from 42 - estimated time to finish is 0 seconds so one line per ft_progress() call. It is possible to erase the previous line (e.g. using '\b' for a backspace character) and simply print over the previous line. This would be better imho (especially where ft_progress() is called hundreds of times, e.g. in freqanalysis).


Eelke Spaak - 2012-04-03 10:28:33 +0200

FYI: for some reason, recent Matlab versions (at least my 2011a on mentat) do not print on the same line when a carriage return (\r) is used, which apparently is what is expected at various places in the code. Therefore, the \b-trick is needed.


Robert Oostenveld - 2012-04-03 10:46:06 +0200

(In reply to comment #1) it not working with \r was the reason for how it is currently done. Please check it both with the full gui and the nojvm option.


Jörn M. Horschig - 2012-04-03 10:49:37 +0200

as a side note: your suggestion is similar to what is being done in ft_sourceanalysis and all the ft_artifact_ functions


Eelke Spaak - 2012-04-17 15:27:57 +0200

bash-3.2$ svn commit utilities/ft_progress.m test/test_ft_progress.m Adding test/test_ft_progress.m Sending utilities/ft_progress.m Transmitting file data .. Committed revision 5638.


Eelke Spaak - 2012-04-17 15:42:53 +0200

bash-3.2$ svn commit utilities/ft_progress.m test/test_ft_progress.m Adding test/test_ft_progress.m Sending utilities/ft_progress.m Transmitting file data .. Committed revision 5638.


Eelke Spaak - 2012-04-17 15:43:37 +0200

(In reply to comment #5) Apologies, that should be 5643, in which I also fixed the compatibility with command-line only instances of matlab.


Eelke Spaak - 2012-08-23 10:35:13 +0200

closing my bugs