MATLAB Application Program Interface Reference Help Desk

matGetDir

Purpose

Get directory of mxArrays in a MAT-file

C Syntax

Arguments

mfp

Pointer to MAT-file information.

num

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

Description

This routine allows you to get a list of the names of the mxArrays contained within a MAT-file.

matGetDir returns a pointer to an internal array containing pointers to the NULL-terminated names of the mxArrays in the MAT-file pointed to by mfp. The length of the internal array (number of mxArrays in the MAT-file) is placed into num. The internal array is allocated using a single mxCalloc and must be freed using mxFree when you are finished with it.

matGetDir returns NULL and sets num to a negative number if it fails. If num is zero, mfp contains no arrays.

MATLAB variable names can by up to length mxMAXNAM, where mxMAXNAM is defined in the file matrix.h.

Examples

Print out a directory of the mxArray names contained within a MAT-file:

See matdemo.c in the eng_mat subdirectory of the examples directory for a sample program that illustrates how to use the MATLAB MAT-file routines in a C program.



[ Previous | Help Desk | Next ]