Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

matGetDir (C and Fortran) - Get directory of mxArrays 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 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.

Description

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.

C Examples

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.

Fortran Examples

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.

  


Recommended Products

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