User`s manual
3 Creating Fortran MEX-Files
3-16
 character*15 string(5)
C Create the string to passed into MATLAB.
 string(1) = 'MATLAB '
 string(2) = 'The Scientific '
 string(3) = 'Computing '
 string(4) = 'Environment '
 string(5) = ' by TMW, Inc.'
C Concatenate the set of 5 strings into a long string.
 thestring = string(1)
 do 10 i = 2, 6
 thestring = thestring(:((i-1)*15)) // string(i)
 10 continue
C Create the string matrix to be passed into MATLAB. 
C Set the matrix size to be M=15 and N=5.
 p_str = mxcreatestring(thestring)
 call mxSetM(p_str, 15)
 call mxSetN(p_str, 5)
C Transpose the resulting matrix in MATLAB.
 call mexCallMATLAB(1, plhs, 1, p_str, 'transpose')
 return
 end
Typing
passstr
at the MATLAB prompt produces this result
ans =
MATLAB 
The Scientific 
Computing 
Environment 
 by TMW, Inc.










