When you program your entire application in MATLAB or when you share data with other MATLAB users, use these MATLAB procedures.
To bring data into a MATLAB application, use Methods for Importing Data.
To save data to a MAT-file, use Save and Load Workspace Variables.
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.
matOpen | Open MAT-file |
matClose | Close MAT-file |
MATFile | Type for MAT-file |
matGetVariable | Array from MAT-file |
matGetVariableInfo | Array header information only |
matGetNextVariable | Next array in MAT-file |
matGetNextVariableInfo | Array header information only |
matPutVariable | Array to MAT-file |
matPutVariableAsGlobal | Array to MAT-file as originating from global workspace |
matDeleteVariable | Delete array from MAT-file |
matGetDir | List of variables in MAT-file |
matGetFp | File pointer to MAT-file |
mxIsFromGlobalWS | Determine whether mxArray was copied from MATLAB global workspace |
matGetErrno | Error codes for MAT-file API |
Table of MAT-File Source Code Files
The matlabroot
/extern/examples/eng_mat
folder contains C/C++ and Fortran source code for examples demonstrating how to use the MAT-file routines.
Custom Applications to Access MAT-Files
Methods of importing and exporting MATLAB data, and MAT-file routines that enable you to do this.
MATLAB requires shared library files for building a MAT-file application.