Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"Freezing" evaluation Output?

1 view
Skip to first unread message

AES

unread,
Aug 21, 2006, 3:55:20 AM8/21/06
to
[I hope people will pardon the ongoing barrage of perhaps absurd
questions I keep posting; the answers are appreciated, and sometimes
even useful.]

Is there any simple programmable way to "freeze" the Output from the
evaluation of an Input cell, so that subsequent reevaluation of the
Input cell doesn't end by erasing the previous output?

E.g., I evaluate a plotting routine that takes a long time to do all its
calculations, and I want to be sure I keep the resulting graphic around
until I'm ready to delete it.

I appreciate there are simple ways to do this "manually":

1) Insert (by hand) a dummy text cell between the Input and Output
cells.

2) Export the Output to somewhere else, with a file name that contains
an execution-time-dependent string.

3) Other similar approaches requiring "operator intervention".

But is there an execution (or output) option for Input cells (or for
individual commands) that says, "Don't replace previous output, even if
it's still there"?

albert

unread,
Aug 21, 2006, 6:37:03 AM8/21/06
to
AES wrote:

It is the Cell-Option CellAutoOverwrite which controles whether a cell is
replaced or not. You can test that with:

CellPrint[Cell["test","Output",CellAutoOverwrite->False]]

which should behave as you suggested.

CellAutoOverwrite is usually set to True for Output, Message, Print and
Graphics cells in the common stylesheets, I think. If you want to not
overwrite e.g. Graphics-Cells you could change CellAutoOverwrite to False
for Graphics-Cells in the StyleSheet you are using. Since this is most
probably something that you don't want globally, you might need some extra
work and write special routines that generate the Cells you want to output,
put CellAutoOverwrite to False for them and write them to your notebook
with CellPrint. You might need to learn about functions like MakeBoxes and
DisplayString to generate Cells containing formatted expressions, graphics,
etc. Maybe there are simpler ways to achieve this, but these I don't
know....


hth,

albert

Jean-Marc Gulliet

unread,
Aug 21, 2006, 6:42:06 AM8/21/06
to
CellAutoOverwrite set to False is the option you need:

"CellAutoOverwrite is an option for Cell which specifies whether new
output obtained by evaluating this cell should overwrite old output. [1]"

HTH,
Jean-Marc

[1] http://documents.wolfram.com/mathematica/functions/CellAutoOverwrite

AES

unread,
Aug 22, 2006, 5:38:32 AM8/22/06
to
In article <ecc2lu$ahu$1...@smc.vnet.net>,
Jean-Marc Gulliet <jeanmarc...@gmail.com> wrote:

> > But is there an execution (or output) option for Input cells (or for
> > individual commands) that says, "Don't replace previous output, even if
> > it's still there"?

> CellAutoOverwrite set to False is the option you need:
>
> "CellAutoOverwrite is an option for Cell which specifies whether new
> output obtained by evaluating this cell should overwrite old output. [1]"
>
> HTH,
> Jean-Marc
>
> [1] http://documents.wolfram.com/mathematica/functions/CellAutoOverwrite

Thank you for this reply -- just what's needed.

But might note: As I read the relevant documentation more carefully, it
really does NOT say precisely, or explicitly, whether the False option
means that the evaluation avoids overwriting old output by writing new
output separately from (presumably above) existing output -- or by just
not writing new output at all.

And what of the quote from the more detailed documentation: "The option
CellAutoOverwrite is typically set to True for styles that represent
Mathematica output."? Does this mean that one should put this option
not in the Input cell that does the evaluation, but in the Output cell
that was previously produced (to protect it)? Or, should "represent
Mathematica output" be "generate Mathematica output"?

Ingolf Dahl

unread,
Aug 22, 2006, 5:48:41 AM8/22/06
to
Hi AES,
Here is an alternative to the answers you have obtained so far: Download my
TaggedCells package from http://web.telia.com/~u31815170/Mathematica/. It is
ideal for this purpose. Install the package and enter then

Needs["TaggedCells`"]

i=1;

ExpressionToTaggedCell[i*i,"Output","Result "<>ToString[i++]];

Evaluate the last command several times, and the output will appear in
reverse order below. As long as the celltags (the third argument above) are
unique, no cell will be overwrittn. You can enter your expression instead of
i*i.

If the output is graphics, you might instead use the following example

Needs["TaggedCells`"]

i=1;

ShowToTaggedCell[Plot[x^i,{x,0.,1.},DisplayFunction->Identity],"Myplot
"<>ToString[i++]];

Again, evaluate the last command several times.

If you want the output in forward order, you might write it to another
notebook. Assume that "Untitled-2" is an open notebook. Use

ShowToTaggedCell[Plot[x^i,{x,0.,1.},DisplayFunction->Identity],"Myplot
"<>ToString[i++], TargetNotebook->"Untitled-2"];

Best regards

Ingolf Dahl

> -----Original Message-----
> From: AES [mailto:sie...@stanford.edu]
> Subject: "Freezing" evaluation Output?
>
> [I hope people will pardon the ongoing barrage of perhaps
> absurd questions I keep posting; the answers are appreciated,
> and sometimes even useful.]
>
> Is there any simple programmable way to "freeze" the Output
> from the evaluation of an Input cell, so that subsequent
> reevaluation of the Input cell doesn't end by erasing the
> previous output?
>
> E.g., I evaluate a plotting routine that takes a long time to
> do all its calculations, and I want to be sure I keep the
> resulting graphic around until I'm ready to delete it.
>
> I appreciate there are simple ways to do this "manually":
>
> 1) Insert (by hand) a dummy text cell between the Input and
> Output cells.
>
> 2) Export the Output to somewhere else, with a file name
> that contains an execution-time-dependent string.
>
> 3) Other similar approaches requiring "operator intervention".
>

albert

unread,
Aug 23, 2006, 7:26:51 AM8/23/06
to
Hi AES,

> And what of the quote from the more detailed documentation: "The option
> CellAutoOverwrite is typically set to True for styles that represent
> Mathematica output."? Does this mean that one should put this option
> not in the Input cell that does the evaluation, but in the Output cell
> that was previously produced (to protect it)? Or, should "represent
> Mathematica output" be "generate Mathematica output"?

The option must be set for the Output Cell. The only ways I know how to do
this is either a) use a special stylesheet or b) construct the Cell
yourself and write it e.g. with CellPrint. Anyway that does not mean it
can't be done in an easier way.

If you are not sure about the documentation, why not just experiment a
little bit? I think it is easy in this case to find out what works and what
doesn't. This does not mean I think the documentation should not be more
clear, but sometimes just trying out is faster than waiting for an update
of the documentation and more reliable than to trust anonymous people
writing to newsgroups :-)


albert

0 new messages