This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Mathematica Import/Export Format

MAT (.mat)

MATLAB MAT-files.
Matrix data format.
Stores matrices of numbers, Boolean values, or strings.
Binary format.
MAT Level 4 files are compatible with MATLAB Version 4 and earlier, while MAT Level 5 files are compatible with MATLAB 5 and later versions.
Mathematica is compatible with MAT levels 4 and 5.
Developed by The MathWorks.
  • Import fully supports MAT Level 4 and 5 files.
  • When appropriate, numerical data is imported as SparseArray objects.
  • 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 expri as specifying the corresponding elemi.
  • 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.
"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
  • Meta-information element:
"Comments"user comments stored in the file