External Interfaces Previous page   Next Page

Passing Strings

Passing strings from MATLAB to a Fortran MEX-file is straightforward. This program accepts a string and returns the characters in reverse order.

Below is the gateway routine that calls the computational routine.

After checking for the correct number of inputs, this MEX-file gateway routine verifies that the input was either a row or column vector string. It then finds the size of the string and places the string into a Fortran character array. Note that in the case of character strings, it is not necessary to copy the data into a Fortran character array by using mxCopyPtrToCharacter. In fact, mxCopyPtrToCharacter works only with MAT-files. For more information about MAT-files, see Importing and Exporting Data.

For an input string



Previous page  A First Example -- Passing a Scalar Passing Arrays of Strings Next page

© 1994-2005 The MathWorks, Inc.