MATLAB Data
Data & ScienceMAT stores MATLAB variables in version-dependent formats; only Version 7.3 is HDF5-based. Files may contain objects, not just arrays. MathWorks warns that load may execute code when initializing variables in untrusted MAT files.
- What it is used for
- Storage of MATLAB arrays, structures and variables
- What the file contains
- Binary data
All sections, questions and sources
Content reviewed: · Editor:Kai
Opening steps
Choose your environment or purpose to see its steps.
Menu labels and support vary by app, OS and version. Preserve the original before making changes.
Troubleshooting by symptom
- Other reader fails: check version, cells, structures and custom classes.
- Too large: review per-variable size and supported partial loading.
- Workspace overwritten: preserve work and load into separate variables/structures.
- SciPy rejects 7.3: inspect loadmat’s version/HDF5 limitation.
- Variables replaced: load into a separate structure.
- Out of memory: inspect dimensions/version and supported partial access.
Numeric MAT variables → CSV / NPY / HDF5
- Select numeric variables in a trusted environment; record shape/units.
- Export suitably and compare ordering, complex values, precision and nulls.
- Compare dimensions, axes, cells/structures and required variables after migration.
CSV cannot retain arbitrary dimensions/objects; renaming MAT to H5 does not create Version 7.3.
Record file version and variable classes
Numeric arrays, cells, structures and objects have different interchange requirements.
Generic HDF5 access does not guarantee complete MATLAB-object reconstruction.
Source for these steps:MathWorks · MAT File Versions / MathWorks · load — Load variables from file / MathWorks · MatFile — Access variables without loading the entire file / SciPy Project · scipy.io.loadmat
Validate partial-array boundaries
Inspect partial-access requirements and record variable/axis selection.
Define handling for multidimensional data before CSV export and retain dimensions/types.
Source for these steps:MathWorks · MAT File Versions / MathWorks · load — Load variables from file / MathWorks · MatFile — Access variables without loading the entire file / SciPy Project · scipy.io.loadmat
Related-format differences
| Format | Main role | What to check |
|---|---|---|
| MAT prior to 7.3 | Earlier MAT storage | Compatible MAT reader |
| MAT 7.3 | HDF5-based storage | MAT structures/partial access |
| CSV | Text table output | Axes/types need documentation |
Handling and security
Do not load unknown MAT merely to inspect it; establish trusted provenance/version and retain originals.
Questions and answers
Is all MAT HDF5?
Version 7.3 uses HDF5; older formats differ.
Is load inherently safe?
Variable initialization may execute code.
Does a plot preserve the data?
Retain numeric arrays separately from visualization images.
Why can array shapes change in Python?
Inspect dimension-squeezing and cell/struct options and compare original axes.
Must I export an entire large array to CSV?
Select required slices with a compatible partial reader and document dimensions/selection.
Format facts: name, steward and MIME type
- Formal name
- MATLAB MAT-file (multiple versions)
- Steward / specification
- MathWorks
- MIME type
- Depends on the producer or server; an extension alone does not establish a MIME type.
Primary and official sources
- Software documentationMAT File Versions
Documents MAT versions and HDF5-based Version 7.3.
MathWorks · Link checked: - Software documentationload — Load variables from file
Documents selected loading and untrusted MAT-file risks.
MathWorks · Link checked: - Official documentationMatFile — Access variables without loading the entire file
Partial access to large MAT files.
MathWorks · Link checked: - Official documentationscipy.io.loadmat
Supported MAT versions and the 7.3/HDF5 limitation.
SciPy Project · Link checked: