9
$\begingroup$

Is there a way to select only printed out cells in Mathematica?

I'm using version 10. I'm told this works in version 11 almost not sure though SelectionMove[First@Cells[CellStyle -> "Output"], All, Cell].

I would like to copy all printed out cells to another notebook.

$\endgroup$
7
$\begingroup$

Another approach which doesn't change the selection and should be more efficient when working with huge Notebooks:

CreateDocument@NotebookRead@Cells[CellStyle -> "Print"]
$\endgroup$
  • $\begingroup$ What version of M are you using? $\endgroup$ – William Oct 26 '16 at 18:19
  • $\begingroup$ @Liam Mathematica 11.0.0, checked with version 10.4.1 as well. This solution should work starting from version 9 where the function Cells was introduced. $\endgroup$ – Alexey Popkov Oct 26 '16 at 22:42
  • $\begingroup$ CreateDocument@NotebookRead@Cells[CellStyle -> "Output"] works so maybe this is my fault and my question was worded poorly. $\endgroup$ – William Oct 26 '16 at 22:56
  • $\begingroup$ @Liam CellStyle -> "Print" is for cells created by the Print command, CellStyle -> "Output" is for usual output cells. $\endgroup$ – Alexey Popkov Oct 27 '16 at 11:18
  • $\begingroup$ Is this the best way to select both Join[Cells[CellStyle -> "Output"], Cells[CellStyle -> "Print"]]. $\endgroup$ – William Oct 27 '16 at 15:13
11
+50
$\begingroup$

Here is a quick way of doing it:

NotebookFind[nb = EvaluationNotebook[], "Print", All, CellStyle];
CreateDocument[NotebookRead[nb]]

enter image description here

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.