| MATLAB® | ![]() |
Put mxArrays into MAT-files as originating from global workspace
#include "mat.h" int matPutVariableAsGlobal(MATFile *mfp, const char *name, const mxArray *pm);
integer*4 matPutVariableAsGlobal(mfp, name, pm) mwPointer mfp, pm character*(*) name
Pointer to MAT-file information
Name of mxArray to put into MAT-file
mxArray pointer
0 if successful and nonzero if an error occurs. In C, use feof and ferror from the Standard C Library with matGetFp to determine status.
This routine puts an mxArray into a MAT-file. matPutVariableAsGlobal is similar to matPutVariable, except that the array, when loaded by MATLAB® software, is placed into the global workspace and a reference to it is set in the local workspace. If you write to a MATLAB 4 format file, matPutVariableAsGlobal does not load it as global and has the same effect as matPutVariable.
matPutVariableAsGlobal writes mxArray pm 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 from the existing mxArray.
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.
![]() | matPutVariable (C and Fortran) | mexAtExit (C and Fortran) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |