Main Content

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

Arguments

mfp

Pointer to MAT-file information

num

Pointer to the variable containing the number ofmxArrays in the MAT-file

Returns

Pointer to an internal array containing pointers to the names of themxArrays in the MAT-file pointed to bymfp. In C, each name is aNULL-terminated string. Thenumoutput argument is the length of the internal array (number ofmxArrays in the MAT-file). Ifnumis zero,mfpcontains no arrays.

matGetDirreturnsNULLin C (0in Fortran). IfmatGetDirfails, setsnumto a negative number.

Description

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

matGetDirallocates memory for the internal array of strings using amxCalloc. Free the memory usingmxFreewhen you are finished with the array.

MATLAB®variable names can be up to lengthmxMAXNAM, defined in the C header filematrix.h.

Examples

See these examples inmatlabroot/extern/examples/eng_mat:

Introduced before R2006a