5
$\begingroup$

generally, when I carry over work in a notebook from the previous day, I have to physically start from the top and re-evaluate every statement before I can begin from where i left off. Is there any setting I can enable so that the notebook will be in state when it becomes active? Thanks, Sid.

$\endgroup$
4
  • 6
    $\begingroup$ No. But you can do: DumpSave["today.mx", "Global`*"] and then load it the next day by Get@"today.mx" $\endgroup$ Oct 3, 2013 at 17:04
  • $\begingroup$ Well, thanks. I have not tried this yet. Actually, this happens also if I leave Mathematica (not quit i.e) for some time and work on other things, and then get back to it. Have others also observed this? I just checked that the "Dynamic updating enabled" menu item was checked, so probably there must be some other setting that can achieve this, in addition to Rolf's answer. $\endgroup$
    – Sid
    Oct 4, 2013 at 17:20
  • 1
    $\begingroup$ The definitions and variables are not associated with the notebook. The notebook merely holds some code that can be used to create these definitions. Rolf's answer is the partial workaround. If you had packages loaded, you'll still need to re-load them. $\endgroup$
    – Szabolcs
    Oct 4, 2013 at 19:43
  • $\begingroup$ @Sid could you upload a notebook somewhere so we can try ourselves? $\endgroup$ Oct 4, 2013 at 19:53

1 Answer 1

6
$\begingroup$

(Based on Rolf's and Szabolcs's comments)

The definitions and variables created during evaluation are not associated with a particular notebook: they are stored in the memory. The notebook merely holds some code that can be used to create these definitions.

You can save all the definition defined in the "Global`" context by DumpSave and then load them the next day by Get:

DumpSave["today.mx", "Global`*"]

Get@"today.mx"

If you want the Get code to be evaluated every time you start the kernel, put the above line into the file:

FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}]

This, however, is only a partial workaround: it does not save any definition from other user-modified namespaces than "Global`" - though it is easy to extend it to other modified contexts if their names are known. Also, if you had packages loaded, it's easier to simply re-load them at the start of your session than to DumpSave their states at the end of the day.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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