Please imagine a simple loop:
For[i=1,i<=100,i++,
Print[i];
];
We can ask Print[]
to output $(1,2,3,4,...)$ to a different notebook (in the context of the same kernel)?
Answer
As Yves already mentioned, you can easily create and edit notebooks through Mathematica commands. A start would be this tutorial, which you can find in the Documentation Center under tutorial/ManipulatingNotebooksFromTheKernel
Here is a short example printing the i
values into a new notebook:
nb = CreateDocument[];
For[i = 1, i <= 10, i++,
SelectionMove[nb, Next, Cell];
NotebookWrite[nb,
Cell[BoxData@RowBox[{"i is now ", ToString[i]}], "Output"]];
]
If you want to know how to construct cell expressions, you could just go over any cell in a notebook and hit Ctrl+Shift+E to see the underlying structure.
Comments
Post a Comment