Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Input and Output / File Output  /
Save

  • Save[" filename ", symbol ] appends definitions associated with the specified symbol to a file.
  • Save[" filename ", " form "] appends definitions associated with all symbols whose names match the string pattern form.
  • Save[" filename ", " context `"] appends definitions associated with all symbols in the specified context.
  • Save[" filename ", , , ... ] appends definitions associated with several objects.
  • Save uses FullDefinition to include subsidiary definitions.
  • Save writes out definitions in InputForm.
  • Save uses Names to find symbols whose names match a given string pattern.
  • You can use Save[" filename ", " s "] to write out the definition for the value of a symbol s itself.
  • See the Mathematica book: Section 1.11.1Section 2.11.1.
  • See also: PutAppend, Get, DumpSave.

    Further Examples

    Here is a definition for a function f and an assignment for the parameter c. We then save the definition of f in the file tempf and clear the two definitions.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=

    In[3]:=

    The file contains both the definition of f and the definition of c on which f depends. You can reinstate the definitions you saved by reading back the file tempf with Get (short form <<).

    In[4]:=

    f[x_] = c + x^3

    c = 17



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.