Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

matGetNextVariable (C and Fortran)

Next array in MAT-file

C Syntax

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

Fortran Syntax

mwPointer matGetNextVariable(mfp, name)
mwPointer mfp
character*(*) name

Arguments

mfp

Pointer to MAT-file information

name

Pointer to the variable containing the mxArray name

Returns

Pointer to a newly allocated mxArray structure representing the next mxArray from the MAT-file pointed to by mfp. The function returns the name of the mxArray in name.

matGetNextVariable returns NULL in C (0 in Fortran) for end of file or if there is an error condition. In C, use feof and ferror from the Standard C Library to determine status.

Description

matGetNextVariable allows you to step sequentially through a MAT-file and read every mxArray in a single pass. The function reads and returns the next mxArray from the MAT-file pointed to by mfp.

Use matGetNextVariable immediately after opening the MAT-file with matOpen and not with other MAT-file routines. Otherwise, the concept of the next mxArray is undefined.

Use mxDestroyArray to destroy the mxArray created by this routine when you are finished with it.

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

Examples

See the following examples in matlabroot/extern/examples/eng_mat.

Introduced before R2006a

Was this topic helpful?