Main Content

matGetNextVariable (C and Fortran)

Next array in MAT-file

C Syntax

#include "mat.h" mxArray *matGetNextVariable(MATFile *mfp, const char **name);

Fortran Syntax

#include "mat.h" mwPointer matGetNextVariable(mfp, name) mwPointer mfp character*(*) name

Arguments

mfp

Pointer to MAT-file information

name

Pointer to the variable containing themxArrayname

Returns

Pointer to a newly allocatedmxArraystructure representing the nextmxArray从MAT-file指出mfp. The function returns the name of themxArrayinname.

matGetNextVariablereturnsNULLin C (0in Fortran) for end of file or if there is an error condition. In C, usefeofandferrorfrom the Standard C Library to determine status.

Description

matGetNextVariableallows you to step sequentially through a MAT-file and read everymxArrayin a single pass. The function reads and returns the nextmxArray从MAT-file指出mfp.

UsematGetNextVariableimmediately after opening the MAT-file withmatOpenand not with other MAT-file routines. Otherwise, the concept of thenextmxArrayis undefined.

UsemxDestroyArrayto destroy themxArraycreated by this routine when you are finished with it.

The order of variables returned from successive calls tomatGetNextVariableis not guaranteed to be the same order in which the variables were written.

Examples

See these examples inmatlabroot/extern/examples/eng_mat:

Introduced before R2006a