MATLAB Application Program Interface Reference | Help Desk |
matPutString
Writecharacter
mxArrays
into MAT-files
integer*4 function matPutString(mfp, name, str) integer*4 mfp character*(*) name, str
mfp
Pointer to MAT-file information.
name
Name of mxArray
to write to MAT-file.
str
Character
array to write to MAT-file.
matPutString
writes the mxArray
with the specified name
and str
to the MAT-file mfp
. It returns 0 if successful, and 1 if an error occurs.
If the mxArray
does not exist on 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.
program main integer matOpen, matClose, matPutString integer mfp, stat c mfp = matOpen('foo.mat', 'w') stat = matPutString(mfp,'A','Hello, world') stat = matClose(mfp) c stop endThen you can go to MATLAB and enter:
load foo
A
A =
Hello, world
Note: Fortran MAT-file routines are not available on Windows.