1
$\begingroup$

If I use a code of this type:

Table[foo[i], {i, 0, 10}] 

Mathematica won't output anything until it is done: is it possible to know at which point of the calculations I am, without using some slow For loop (in this way it would be easy to print something like i=1, i=2...)?

I want to check if everything is OK at each step.

$\endgroup$
1
  • 2
    $\begingroup$ Table[n = i; Pause[1]; foo[i], {i, 0, 10}]; Labeled[ProgressIndicator[Dynamic[n], {0, 10}], Dynamic[n], Right] for overkill $\endgroup$ Commented Jul 29, 2014 at 15:49

1 Answer 1

4
$\begingroup$

The simplest way is to put a Print expression into your Table expression.

Table[Print["i = ", i]; foo[i], {i, 0, 10}] 

If you only want to see the what is printed while the evaluation is running and have it automatically deleted upon completion, then use

Table[PrintTemporary["i = ", i]; foo[i], {i, 0, 10}] 
$\endgroup$
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.