How tbeu/matio works
Matio is a C library for reading and writing MATLAB MAT files. A client program calls its public API to open or create a file, then reads variables or writes them; the library supports MAT versions 4, 5, and optionally 7.3. Version-specific handlers implement the file formats, with shared data and variable helpers, and optional zlib and HDF5 support. MCOS and a Fortran interface are additional capabilities. Relationships among internal modules are limited to those supported by the source index; unsampled call paths are omitted or marked unverified.
Main entry points: mat.c File Operations · mat5.c MAT v5 Handler · mat73.c MAT v7.3 Handler · matio.h Public C API
Components 18
Library API
- Public C API
src/matio.h - File Operations
src/mat.c
MAT File Formats
- MAT v4 Handler
src/mat4.c - MAT v5 Handler
src/mat5.c - MAT v7.3 Handler
src/mat73.c
Variables and Data
- Data Reading
src/read_data.c - Cell Variables
src/matvar_cell.c - Struct Variables
src/matvar_struct.c - MCOS Objects
src/mcos.c - File and Byte I/O
src/io.c - Decompression
src/inflate.c - Safe Arithmetic
src/safe-math.h
Additional Interfaces
- Fortran Interface
src/fortran - MAT File Dumper
tools/matdump.c
Other components
- Client Program
- MAT File
- zlib
- HDF5
Connections 23
- Client Program → Public C API: calls
README.md - Public C API → File Operations: exposes operations
- File Operations → MAT File: opens or creates
- File Operations → MAT v4 Handler: dispatches
- File Operations → MAT v5 Handler: dispatches
src/mat.c - File Operations → MAT v7.3 Handler: dispatches
src/mat.c - MAT v4 Handler → MAT File: reads or writes
- MAT v5 Handler → MAT File: reads or writes
- MAT v7.3 Handler → MAT File: reads or writes
- MAT v5 Handler → MCOS Objects: uses
src/mat5.c - MAT v7.3 Handler → MCOS Objects: uses
src/mat73.c - File Operations → Safe Arithmetic: uses
src/mat.c - Data Reading → Safe Arithmetic: uses
src/read_data.c - File Operations → Data Reading: reads data
- File Operations → Cell Variables: handles cells
- File Operations → Struct Variables: handles structs
- File Operations → File and Byte I/O: uses
- MAT v5 Handler → Decompression: decompresses
- MAT v5 Handler → zlib: optional compression
README.md - MAT v7.3 Handler → HDF5: optional storage
README.md - Client Program → Fortran Interface: may use
README.md - Client Program → MAT File Dumper: may run
- MAT File Dumper → Public C API: uses library API
tools/matdump.c