1
$\begingroup$

I have a very big notebook with a command repeated a lot of times but with different parameters each time and I want to run all these commands at the same time without having to run separately all of them. Is there a way?

EDIT: more info

Between different calls of the 'command' there are other things (mainly plots) and I want to preserve the order of the notebook.

Using the Evaluate Notebook form the menu Evaluation can be an option but when I am in a hurry this is bad because it evaluates also all the things in between while I am mainly interested in the output of my commands.

$\endgroup$
  • $\begingroup$ Any reason not to just merge the cells into one, or better yet, change the 'command' to accept arguments and then map/table over the different parameters? $\endgroup$ – ciao Jan 21 '14 at 12:26
  • $\begingroup$ @rasher between different calls of my 'command' there are things and I want to preserve this ordering for formatting reasons $\endgroup$ – Red Jan 21 '14 at 12:29
  • $\begingroup$ Ah, ok then, what about the Evaluate Notebook menu item? NVM - I missed the 'same name' part... $\endgroup$ – ciao Jan 21 '14 at 12:34
  • $\begingroup$ @rasher I added more info in the question $\endgroup$ – Red Jan 21 '14 at 12:41
  • $\begingroup$ You could mark the cells you don't want evaluated as such in the cell menu (you can collectively do this). Otherwise, probably some notebook programming involved. $\endgroup$ – ciao Jan 21 '14 at 12:43
1
$\begingroup$

As requested:

Use tags on the cells you want (same tag for all), then NotebookLocate andSelectionEvaluate together.

$\endgroup$
4
$\begingroup$

I get it using this code:

nb = EvaluationNotebook[];
NotebookEvaluate[nb, InsertResults -> True, EvaluationElements -> {"Tags" -> {"evaluate"}}];

and tagging with the tag evaluate only the cells that I want to evaluate on first run.

$\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.