--- id: mat73 version: "0.65" license: GPL3 license_treatment: copyleft maintenance: active --- # mat73 — Load MATLAB .mat 7.3 into Python native data types (via h5/hd5/hdf5/h5py) License: copyleft · Maintenance: active · Downloads: 77.9K/mo ## What it is and what it does mat73 fills a gap left by scipy.io.loadmat, which cannot read MATLAB 7.3 .mat files because they are stored as HDF5 containers. This library wraps h5py and numpy to parse those HDF5 files and reconstruct them as native Python dictionaries, with optional attribute-style access for struct members. It handles standard MATLAB datatypes (numeric arrays, strings, structs as lists of dicts, cells as nested lists, sparse matrices) and can selectively load only specified variables or subtrees to reduce memory overhead. The package is straightforward to use—a single loadmat() call returns a dictionary—but is narrowly scoped: it only handles MATLAB 7.3 files, does not support proprietary MATLAB types, and cannot write .mat files back. It depends on h5py for HDF5 access and numpy for array representation, both widely available. Use it for: - Load simulation or experimental data saved from MATLAB into Python for analysis with scientific libraries. - Extract specific variables from large .mat files without loading the entire file into memory using the only_include parameter. - Migrate MATLAB-based workflows to Python by reading existing .mat archives as dictionaries. - Access nested MATLAB struct hierarchies using Python attribute syntax for cleaner code. - Convert MATLAB sparse matrices into scipy.sparse format for linear algebra operations in Python. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Loads MATLAB 7.3 .mat files (stored as HDF5) into Python dictionaries with support for struct attribute access and selective variable loading. Yes, if you need to read MATLAB 7.3 .mat files in Python. The package is stable, has low install friction, and solves a specific problem scipy.io.loadmat does not. The GPLv3 copyleft license is a consideration for proprietary projects. The repository remains active with no known vulnerabilities. ## Install pip install mat73 uv add mat73 poetry add mat73 ## Installing mat73 Before you install: Low friction install with two common dependencies (h5py, numpy). Repository is active with recent commits and moderate community engagement (177 stars). License in practice: GPLv3 copyleft license means any derivative work or distribution must also be open source under GPLv3 terms—acceptable for internal tools or open projects, but restrictive for proprietary software. Quickstart: pip install mat73 import mat73 data_dict = mat73.loadmat('data.mat') struct = data_dict['structure'] var = struct[0].var1 # with use_attrdict=True Requires a MATLAB 7.3 .mat file; older .mat versions are not supported by this library. Verify before relying: - Whether the gap between last release (2024-07-24) and current date indicates active maintenance or dormancy despite recent repo commits. - Performance characteristics when loading large .mat files or deeply nested structures. - Completeness of support for all HDF5 structures that MATLAB 7.3 can generate. ## Package facts - License: GPL3 (copyleft) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 77.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags load matlab mat files python, matlab 7.3 hdf5 reader, convert mat to python dict, matlab struct to python, hdf5 matlab file loader, mat73 file parser, matlab-interop, data-loading, hdf5 [View on SkillFed](https://skillfed.io/packages/mat73) · [View on PyPI](https://pypi.org/project/mat73/)