Re: How write output to another notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg27818] Re: How write output to another notebook?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 19 Mar 2001 01:29:09 -0500 (EST)
- References: <98vi9q$91l@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Murray,
nb = NotebookCreate[];
NotebookWrite[nb,
Cell[BoxData[
ToBoxes[{1,2}+{3,4}], "Output"]
]
]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Murray Eisenberg" <murray at math.umass.edu> wrote in message
news:98vi9q$91l at smc.vnet.net...
> How (in Mathematica 4.1) can I cause evaluation of an input cell in one
> notebook to put the resulting Output cell in another, open notebook?
>
> I know about the function NotebookWrite, but I need to cause it to write
> the Cell[...., "Output"] expression resulting from evaluating an
> arbitrary Input cell.
>
> For something VERY simple, I could "fake" it, e.g., to write the result
> of 1 + 2 to the open notebook corresponding to a notebook object nb, I
> would use:
>
> NotebookWrite[nb, 1 + 2]
>
> But to write the output cell corresponding to, say,
>
> {1, 2} + {3, 4}
>
> I CANNOT use merely NotebookWrite[nb, {1, 2} + {3, 4}]. Rather, I need
> to construct "manually" the entire output cell expression:
>
> NotebookWrite[nb, Cell[BoxData[
> RowBox[{"{",
> RowBox[{"4", ",", "6"}], "}"}]], "Output",
> CellLabel->"Out[12]="]]
>
> The difficulty is that I do not know ahead of time what the output will
> be for a given input, so I need Mathematica to create the appropriate
> Cell expression that I may then use as the argument to NotebookWrite.
>
> How can I do that?
>