This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

MAT-File API Library and Include Files

MATLAB® provides include and library files to write programs to read and write MAT-files. The following table lists the path names to these files. The term matlabroot refers to the root folder of your MATLAB installation. The term arch is a unique string identifying the platform.

MAT-File API Folders




Microsoft® Windows®

Include files







Include files






MAT-File API Include Files

The matlabroot\extern\include folder holds header files containing function declarations with prototypes for the routines that you can access in the API Library. These files are the same for Windows, macOS, and Linux systems. The folder contains:

  • The matrix.h header file that contains a definition of the mxArray structure and function prototypes for matrix access routines.

  • The mat.h header file that contains function prototypes for mat routines.

MAT-File API Libraries

The name of the libraries folder, which contains the shared (dynamically linkable) libraries, is platform-dependent.

Shared Libraries on Windows Systems

The bin folder contains the run-time version of the shared libraries:

  • The libmat.dll library of MAT-file routines (C/C++ and Fortran)

  • The libmx.dll library of array access and creation routines

Shared Libraries on macOS and Linux Systems

The bin/arch folder, where arch is the value returned by the computer('arch') command, contains the shared libraries. For example, on Apple macOS 64-bit systems, the folder is bin/maci64:

  • The libmat.dylib library of MAT-file routines (C/C++ and Fortran)

  • The libmx.dylib library of array access and creation routines

Example Files

The extern/examples/eng_mat folder contains C/C++ and Fortran source code for examples demonstrating how to use the MAT-file routines.