I am trying to crudely approximate the RStudio or Matlab Workspace environment in Mathematica by having a specific notebook function as the "console notebook" where I execute commands and another notebook function as the "output notebook".
Is there a simple way to only output the evaluated code from the specific notebook I designate as the "console notebook" to the notebook I designate as the "output notebook"?
Unfortunately, the code below outputs from any open notebook to the output notebook ("outputNB" below). I would just like to output from consoleNB to outputNB. Btw, code is taken from wolfram community forum
outputNB=NotebookCreate[];
$DisplayFunction=(NotebookWrite[outputNB,{Cell[BoxData@ToBoxes@#,"Output"]},After]
)&;
$DisplayFunction
if yourEvaluationNotebook
matches your console notebook. Or add some option (CellEvaluationFunction
?) to your notebook that wraps your code into aBlock
that changes the$DisplayFunction
$\endgroup$ – Rojo Mar 6 '16 at 14:46