| MATLAB Application Program Interface | Search  Help Desk |
| matPutArray | Examples |
C Syntax
#include "mat.h" int matPutArray(MATFile *mfp, const mxArray *mp);
Arguments
mfp
mp
Description
This routine allows you to put an mxArray into a MAT-file.matPutArray writes mxArray mp to the MAT-file mfp. If the mxArray does not exist in the MAT-file, it is appended to the end. If an mxArray with the same name already exists in the file, the existing mxArray is replaced with the new mxArray by rewriting the file. The size of the new mxArray can be different than the existing mxArray.
matPutArray returns 0 if successful and nonzero if an error occurs. Use feof and ferror from the Standard C Library along with matGetFp to determine status.
Example
Seematcreat.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.