Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Data Manipulation > Files > Mathematica Expressions in Files >

Put (>>)

expr>>filename
writes expr to a file.
Put[expr1, expr2, ..., "filename"]
writes a sequence of expressions expri to a file.
Put["filename"]
creates an empty file with the specified name.
  • Put starts writing output at the beginning of the file. It deletes whatever was previously in the file.
  • Put inserts a newline (line feed) at the end of its output.
  • expr>>filename is equivalent to expr>>"filename". The double quotes can be omitted if the file name is of the form specified in "Operator Input Forms".
  • It is conventional to use names that end with .m for files containing Mathematica input.
Save a computed value in a temporary file:
Set the current directory to one for temporary files:
Put the value of a into a file:
The file now contains the value:
Reset the directory:
Save a computed value in a temporary file:
In[1]:=
Click for copyable input
Out[1]=
Set the current directory to one for temporary files:
In[2]:=
Click for copyable input
Put the value of a into a file:
In[3]:=
Click for copyable input
The file now contains the value:
Reset the directory:
In[5]:=
Click for copyable input
New in 1 | Last modified in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team