Main Content

Write C Programs to Read MAT-File Data

Read and write MATLAB® data from C programs, using mxArray

When you program your entire application in MATLAB or when you share data with other MATLAB users, use these MATLAB procedures.

There are situations, however, when you must write a custom program to interact with data. For example:

  • Your data has a custom format.

  • You create applications for users who do not run MATLAB, and you want to provide them with MATLAB data.

  • You want to read data from an external application, but you do not have access to the source code.

C MAT-File API

matOpenOpen MAT-file
matCloseClose MAT-file
MATFileType for MAT-file
matGetVariableArray from MAT-file
matGetVariableInfoArray header information only
matGetNextVariableNext array in MAT-file
matGetNextVariableInfoArray header information only
matPutVariableArray to MAT-file
matPutVariableAsGlobalArray to MAT-file as originating from global workspace
matDeleteVariableDelete array from MAT-file
matGetDirList of variables in MAT-file
matGetFpFile pointer to MAT-file
mxIsFromGlobalWSDetermine whether mxArray was copied from MATLAB global workspace
matGetErrnoError codes for MAT-file API

Topics

Related Information