External Interfaces/API Reference | ![]() ![]() |
Write character
mxArray
s
into MAT-files
Fortran Syntax
integer*4 function matPutString(mfp, name, str) integer*4 mfp character*(*) name, str
Arguments
mfp
Pointer to MAT-file information.
name
mxArray
to write to MAT-file.
str
character
array to write to MAT-file.
Description
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.
Example
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 end
Then you can go to MATLAB and enter:
load foo
A
A =
Hello, world
![]() | matPutMatrix | Fortran MEX-Functions | ![]() |