Passing arrays of strings adds a complication to the example Pass Strings. Because MATLAB® stores elements of a matrix by column instead of by row, the size of the string array must be correctly defined in the Fortran MEX file. The key point is that the row and column sizes as defined in MATLAB must be reversed in the Fortran MEX file. So, when returning to MATLAB, the output matrix must be transposed.
This example places a string array/character matrix into MATLAB as output arguments rather than placing it directly into the workspace.
To build this example, at the command prompt type:
to create the
You need to do some further manipulation. The original string matrix
15. Because of the way MATLAB reads
and orients elements in matrices, the size of the matrix must be defined
N=5 in the MEX file.
After the matrix is put into MATLAB, the matrix must be transposed.
passstr.F illustrates how to pass a
character matrix. To see the code
the file in MATLAB Editor.
ans = MATLAB The Scientific Computing Environment by TMW, Inc.