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

Address of the variable to contain the number of mxArrays in the MAT-file

Returns

A 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 eng_mat subdirectory of the examples directory for sample programs that illustrate how to use the MATLAB MAT-file routines in a C program.

Fortran Examples

See matdemo2.F in the eng_mat subdirectory of the examples directory for a sample program that illustrates how to use this MAT-file routine in a Fortran program.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS