|
SOLUTIONS
|
MATHEMATICA IMPORT/EXPORT FORMAT
List
Column of numbers or strings.
Stores a list of numbers or strings as lines.
Plain text format.
Is essentially a single-column version of the "Table" format.
Stores a list of numbers or strings as lines.
Plain text format.
Is essentially a single-column version of the "Table" format.
- Import and Export provide various data conversion and formatting options for storing lists of numbers or strings.
- Import automatically recognizes common number formats, including C and Fortran notations.
- Numbers without decimal points are imported as integers.
Import and ExportImport and Export
- Import["file", "List"] imports a text file, returning each line as a string or a number.
- Export["file", list, "List"] writes any list as a column of numbers or strings.
- Import["file", "List"] returns a list of strings or numbers, each representing a line of file.
- Export["file", list, "List"] exports list as a column, writing the CForm of each element as a separate line.
- Import["file", {"List", elem} ] imports the specified element from a
file. - Import["file", {"List", elem, suba, subb, ...}] imports a subelement.
- Import["file", {"List", {elem1, elem2, ...}}] imports multiple elements.
- The format
must be explicitly given. - Export["file", expr, {"List", elem}] creates a
file by treating expr as specifying element elem. - Export["file", {expr1, expr2, ...}, {"List", {elem1, elem2, ...}}] treats each
as specifying the corresponding
. - Export["file", expr, "List", opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
- Export["file", {elem1->expr1, elem2->expr2, ...}, {"List", "Rules"}] uses rules to specify the elements to be exported.
- See the reference pages for full general information on Import and Export.
- ImportString and ExportString support the
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 - Data representation elements:
-
"Data" list of numbers or strings, each representing a line "Grid" list data as a Grid object - Import and Export use the
element by default.
OptionsOptions
- General Export options:
-
Alignment None how data is aligned within table columns CharacterEncoding "UTF8" raw character encoding used in the file - Possible settings for Alignment are None, Left, Center, and Right.
- General Import option:
-
CharacterEncoding "ASCII" raw character encoding used in the file - Import and Export option:
-
"EmptyField" "" how to represent empty fields - Import options:
-
"CurrencyTokens" {{"$", "
", "
", "
"}, {"c", "
", "p", "F"}}currency units to be skipped when importing numerical values "DateStringFormat" None date format, given as a DateString specification "IgnoreEmptyLines" False whether to ignore empty lines "LineSeparators" {"\r\n","\n","\r"} string tokens taken to separate list elements "Numeric" True whether to import data fields as numbers if possible "NumberPoint" "." string to use for a decimal point "NumberSigns" {"-","+"} strings to use for signs of negative and positive numbers "HeaderLines" 0 number of lines to skip at the beginning of the file - Import converts table entries formatted as specified by the
option to a DateList representation of the form
. - Empty lines and lines containing only whitespace characters are converted to an empty string by default. With
set to True, Import will skip empty lines. - With "Numeric"->False, numbers will be imported as strings in the form they appear in the file.
- All common conventions for the encoding of newline characters are recognized with the default setting of
.
New in 4 | Last modified in 9
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »

