User`s manual
Examples of Fortran MEX-Files
3-9
Examples of Fortran MEX-Files
The following sections include information and examples describing how to
pass and manipulate the different data types when working with MEX-files.
These topics include:
•“A First Example — Passing a Scalar”
•“Passing Strings”
•“Passing Arrays of Strings”
•“Passing Matrices”
•“Passing Two or More Inputs or Outputs”
•“Handling Complex Data”
•“Dynamically Allocating Memory”
•“Handling Sparse Matrices”
•“Calling Functions from Fortran MEX-Files”
The MATLAB API provides a set of routines for Fortran that handle
double-precision data and strings in MATLAB. For each data type, there is a
specific set of functions that you can use for data manipulation.
Note to UNIX Users The example Fortran files in the directory <matlab>/
extern/examples/refbook
have extensions .F and .f. The distinction
between these extensions is that the .F files need to be preprocessed.
Note You can find the most recent versions of the example programs from
this chapter at the anonymous FTP server,
ftp://ftp.mathworks.com/pub/tech-support/docexamples/apiguide/R12/refbook