7
$\begingroup$

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]
)&;
$\endgroup$
  • 1
    $\begingroup$ Perhaps you could check in your $DisplayFunction if your EvaluationNotebook matches your console notebook. Or add some option (CellEvaluationFunction?) to your notebook that wraps your code into a Block that changes the $DisplayFunction $\endgroup$ – Rojo Mar 6 '16 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.