Contents

matGetDir (C and Fortran)

List of variables in MAT-file

C Syntax

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

Fortran Syntax

mwPointer matGetDir(mfp, num)
mwPointer mfp
integer*4 num

Arguments

mfp

Pointer to MAT-file information

num

Pointer to the variable containing the number of mxArrays in the MAT-file

Returns

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.

Description

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. You must 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.

Examples

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

Was this topic helpful?