|
SOLUTIONS
|
MATHEMATICA IMPORT/EXPORT FORMAT
MAT (.mat)
MATLAB MAT-files.
Matrix data format.
Native data format of the MATLAB numerical computation software.
Stores numerical matrices, Boolean values, or strings.
Binary format.
MAT Level 4 files are compatible with MATLAB Version 4 and lower, while MAT 5 files are compatible with MATLAB Version 5 and higher versions.
Matrix data format.
Native data format of the MATLAB numerical computation software.
Stores numerical matrices, Boolean values, or strings.
Binary format.
MAT Level 4 files are compatible with MATLAB Version 4 and lower, while MAT 5 files are compatible with MATLAB Version 5 and higher versions.
- Import fully supports Versions 4 and 5 of the MAT format.
- When appropriate, numerical data is imported as SparseArray objects.
- Export generates MAT 4 files.
Import and ExportImport and Export
- Import["file.mat"] imports a MAT-file, returning an array.
- Export["file.mat", expr] exports any numeric array to a MAT-file.
- Import["file.mat"] returns a multidimensional array containing numbers, strings, or Boolean values.
- Export["file.mat", expr] creates a MAT-file from an array of integers or doubles.
- Import["file.mat", elem] imports the specified element from a MAT-file.
- Import["file.mat", {elem, suba, subb, ...}] imports a subelement.
- Import["file.mat", {{elem1, elem2, ...}}] imports multiple elements.
- The import format can be specified with Import["file", "MAT"] or Import["file", {"MAT", elem, ...}].
- Export["file.mat", expr, elem] creates a MAT-file by treating expr as specifying element elem.
- Export["file.mat", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each
as specifying the corresponding
. - Export["file.mat", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
- Export["file.mat", {elem1->expr1, elem2->expr2, ...}, "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 MAT 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 element:
-
"Data" numerical or textual data given as a multidimensional array "LabeledData" data given as a list of rules - Import and Export use the
element by default. - Meta-information element:
-
"Comments" user comments stored in the file "Labels" dataset names given as a list of strings
ExamplesExamplesopen allclose all
Basic Examples (4)Basic Examples (4)
This imports a simple MAT-file:
| In[1]:= |
| Out[1]= |
List available Import elements
| In[1]:= |
| Out[1]= |
Import raw meta-information from this file:
| In[1]:= |
| Out[1]= |
| In[1]:= |
| Out[1]= |
Export a few named datasets and import the resulting file:
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= |
Export a named dataset using element specifications:
| In[1]:= |
| Out[1]= |
New in 5.1 | Last modified in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
