3
$\begingroup$

This question already has an answer here:

This is my first post on this StackExchange. I made a Mathematica Notebook with a simulated data set the other day, just to learn the basics of making different graphs and creating a linear regression, etc.

I figured now that I had the Notebook created that I would be able to open the Notebook and completely continue where I left off. (In the previous session I said model = LinearModelFit[data, {1, x}, x].) However while when I type "mo..." it suggests model, it doesn't extend this to behaving as it did before when I typed, say, model["BestFit"] to get the function form. Instead, once I've reloaded a saved Notebook in which model has already been defined it does this:

Input:

model["BestFit"]

Output:

model[BestFit]

Simply without the quotes! All functions that would be processed do this instead. While I'm not complaining if this isn't the case, it seems likely I'm just missing something simple about saving/reloading that would allow me to completely continue where I left off, without first re-processing all my inputs in order again.

Anyone know a solution to this problem?


Thank you xslittlegrass & Nasser for your clarifications on DumpSave; from what I can tell it performs what I was asking for. A more succinct way to state my question would have been "can I save the kernel state?" as was asked in the following link's question. Copy-pasting the answer from the link xslittlegrass posted:

"No, currently you can not save the kernel state; restarting the Kernel from a previous state would need to modify and re-instantiate all sort of things." -ruebenko

"While it is true that you can not save a full state of the kernel, in some cases it may be enough for your purposes to save all symbols' definitions in some context(s), such as Global` (or whatever other contexts are of interest to you). This can be done via DumpSave, like

DumpSave["state.mx", "Global`"]

The .mx file generated by DumpSave will be platform-specific though. By using Get at some later point, you can reconstruct the values stored in symbols in those contexts you saved:

Get["state.mx"]

As stated already by @ruebenko, this will not generally fully reconstruct the kernel state. But if you manage to correctly account for all symbols (defined by you) which affect your computations, and depending on the circumstances, this may be enough for many practical purposes." -Leonid Shifrin

Also, from following Mr. Shifrin's steps, it's important to note that you can name the file "state.mx" whatever you like (I chose 01.mx) and that if you do not specify a location during the DumpSave command, it will default to saving it to your Documents folder in C:\Users\User\Documents\01.mx. Likewise, if you use the Get command after reloading Mathematica and have moved the file from the default Documents folder, if you don't specify where it should look, Mathematica will fail to find it.

Thanks for everyone's input.

$\endgroup$

marked as duplicate by rm -rf Feb 24 '13 at 21:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I think DumpSave may work for you. Here are examples. $\endgroup$ – xslittlegrass Feb 20 '13 at 21:28
  • 1
    $\begingroup$ Nicholas, welcome to Mathematica.SE. I edited your answer in a few ways. First, this is not a "forum" in the conventional Internet meaning of the term. See this. Also, I capitalized Notebook to reflect that this is a specific file type. I also added code tags (read editing help) and removed your salutation as your "signature" appears below every post you make. $\endgroup$ – Mr.Wizard Feb 20 '13 at 22:19
  • $\begingroup$ @Nasser. Please write up your comment as an answer. $\endgroup$ – m_goldberg Feb 21 '13 at 4:10

Browse other questions tagged or ask your own question.