MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
matGetNextArray    Examples

Read next mxArray from MAT-file

C Syntax

Arguments

mfp
  Pointer to MAT-file information.

Description

matGetNextArray allows you to step sequentially through a MAT-file and read all the mxArrays in a single pass.

matGetNextArray reads the next mxArray from the MAT-file pointed to by mfp and returns a pointer to a newly allocated mxArray structure. Use it immediately after opening the MAT-file with matOpen and not in conjunction with other MAT-file routines; otherwise, the concept of the next mxArray is undefined.

matGetNextArray returns NULL when the end-of-file is reached or if there is an error condition. Use feof and ferror from the Standard C Library to determine status.

Be careful in your code to free the mxArray created by this routine when you are finished with it.

Example

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.



[ Previous | Help Desk | Next ]