|
SOLUTIONS
|
MATHEMATICA IMPORT/EXPORT FORMAT
Package (.m)
Registered MIME type: 
Mathematica package source format.
Used for storing and exchanging Mathematica programs, packages, and data.
Plain ASCII text format.
Stores Mathematica expressions in InputForm.
Can represent program code, numerical and textual data, 2D raster and vector images, 3D geometries, sound, and other kinds of data.
Developed since 1988 by Wolfram Research.
Mathematica package source format.
Used for storing and exchanging Mathematica programs, packages, and data.
Plain ASCII text format.
Stores Mathematica expressions in InputForm.
Can represent program code, numerical and textual data, 2D raster and vector images, 3D geometries, sound, and other kinds of data.
Developed since 1988 by Wolfram Research.
Import and ExportImport and Export
- Import["file.m"] reads in a Mathematica package, evaluating each expression in it, and returning the last one.
- Export["file.m", expr] exports a single expression to a package source file.
- Mathematica always uses CharacterEncoding->"ASCII" for package source files.
- Import["file.m", elem] imports the specified element from a package source file.
- Import["file.m", {elem, suba, subb, ...}] imports a subelement.
- Import["file.m", {{elem1, elem2, ...}}] imports multiple elements.
- The import format can be specified with Import["file", "Package"] or Import["file", {"Package", elem, ...}].
- Import["file.m"] is equivalent to Get["file.m"].
- Export["file.m", expr, elem] creates a Mathematica source file by treating expr as specifying element elem.
- Export["file.m", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each
as specifying the corresponding
. - Export["file.m", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
- Export["file.m", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
- Put[expr1, expr2, ..., "file.m"] can be used to export multiple expressions.
- See the reference pages for full general information on Import and Export.
- ImportString and ExportString support the package format.
ElementsElements
- General Import elements:
-
"Elements" list of elements and options available in this file "Rules" full list of rules for each element and option "Options" list of rules for options, properties, and settings - Import elements:
-
"ExpressionList" evaluates all expressions and returns the results as a list "Get" reads and evaluates all expressions, returning the last one "HeldExpressions" list of unevaluated expressions "Comments" code comments - Import by default uses the
element for Mathematica Package files.
New in 1 | Last modified in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »


