| MATLAB® | ![]() |
A handle to a MAT-file object. A MAT-file is the data file format MATLAB® software uses for saving data to your disk.
MATFile is a C language opaque type.
The MAT-file interface library contains routines for reading and writing MAT-files. These routines are listed in MAT-File Access. You call these routines from your own C and Fortran programs, using MATFile to access your data file.
The header file containing this type is:
#include "mat.h"
The example matcreat.c in your matlabroot/extern/examples/eng_mat directory shows how to create and use a MAT-file.
The matOpen function creates the file mattest.mat.
The mxCreateDoubleMatrix and mxCreateString functions create mxArrays pa1, pa2, and pa3. mxCreateString also initializes pa3 using the literal string "MATLAB: the language of technical computing". The C function memcpy copies data (initialized in matcreat.c) into pa2.
The matPutVariable and matPutVariableAsGlobal functions write the data to mattest.mat.
Calls to the matClose and mxDestroyArray functions complete the procedure.
Other examples, also found in your matlabroot\extern\examples\eng_mat directory, that show you how to use MATFile are:
matdgns.c shows how to use MAT-file routines in a C program.
matdemo1.F and matdemo2.F show how to use MAT-file routines in a Fortran program.
matOpen, matClose, matPutVariable, matGetVariable, mxDestroyArray
![]() | matDeleteVariable (C and Fortran) | matGetDir (C and Fortran) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |