This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

matGetDir (C and Fortran)

List of variables in MAT-file

C Syntax

#include "mat.h"
char **matGetDir(MATFile *mfp, int *num);

Fortran Syntax

#include "mat.h"
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 num output argument is the length of the internal array (number of mxArrays in the MAT-file). If num is zero, mfp contains no arrays.

matGetDir returns NULL in C (0 in Fortran). If matGetDir fails, sets num to a negative number.


This routine provides you with a list of the names of the mxArrays contained within a MAT-file.

matGetDir allocates memory for the internal array of strings using a mxCalloc. Free the memory using mxFree when you are finished with the array.

MATLAB® variable names can be up to length mxMAXNAM, defined in the C header file matrix.h.


See the following examples in matlabroot/extern/examples/eng_mat.

Introduced before R2006a

Was this topic helpful?