18
$\begingroup$

I am writing a bash script to run a bunch of Mathematica .nb files serially. So I thought I'd convert my Mathematica cells into initialization cells. However, I notice that the initialization cell isn't run on start up unless I evaluate it using Shift + Enter or Command + Enter.

Is it not an initialization cell that I am looking for?

Steps I took to make my cell an initialization cell:

  1. Selected the cell with mouse click
  2. Cell > Cell properties > Initialization cell

Edit

I just added InitializationCellEvaluation -> True as the first line of my file. However, how should I make this evaluatable?

$\endgroup$
4
  • $\begingroup$ Move your edits into an answer, so that others can use it, too. $\endgroup$
    – rcollyer
    Aug 15, 2012 at 21:59
  • $\begingroup$ @rcollyer I felt a little odd about answering my own question! $\endgroup$
    – dearN
    Aug 15, 2012 at 22:03
  • $\begingroup$ Its expressly encouraged. You might as well get the points for it. $\endgroup$
    – rcollyer
    Aug 15, 2012 at 22:35
  • $\begingroup$ @rcollyer Thanks mate! :) $\endgroup$
    – dearN
    Aug 15, 2012 at 22:37

1 Answer 1

17
$\begingroup$

I think I found it but I'd be more than happy to look at other alternatives if any provided:

  1. Shift + Ctrl + O to open Options > Notebook options > Evaluation options > Global preferences from the drop down menu at the top

  2. Change InitializationCellEvaluation to True and InitializationCellWarning to False

The next time the .nb file is launched, the initialization cell is run.

$\endgroup$
2
  • 1
    $\begingroup$ Does it work to set it only for a specific notebook and leave preferences untouched? $\endgroup$ Aug 15, 2012 at 23:03
  • 1
    $\begingroup$ @VitaliyKaurov It does but I changed it at the global level. $\endgroup$
    – dearN
    Aug 15, 2012 at 23:16

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