| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "mat.h" char **matGetDir(MATFile *mfp, int *num);
mwPointer matGetDir(mfp, num) mwPointer mfp integer*4 num
Pointer to MAT-file information
Pointer to the variable containing the number of mxArrays in the MAT-file
Pointer to an internal array containing pointers to the names of the mxArrays in the MAT-file pointed to by mfp. In C, each name is a NULL-terminated string. The length of the internal array (number of mxArrays in the MAT-file) is placed into num. If num is zero, mfp contains no arrays.
matGetDir returns NULL in C (0 in Fortran) and sets num to a negative number if it fails.
This routine allows you to get a list of the names of the mxArrays contained within a MAT-file.
The internal array of strings that matGetDir returns is allocated using a single mxCalloc and must be freed using mxFree when you are finished with it.
MATLAB variable names can be up to length mxMAXNAM, where mxMAXNAM is defined in the C header file matrix.h.
See matcreat.c and matdgns.c in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to use the MAT-file routines in a C program.
See matdemo2.F in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to use the MAT-file routines in a Fortran program.
![]() | MATFile (C and Fortran) | matGetFp (C) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |