See other catalogues for
The MathWorks
You may also be interested in
Text version of the page
| | | | | | | | | | | | |
| | | |
| | | Fortran Source MEX-Files | | |
| | | |
| | | In addition, Fortran MEX-files require the fintrf.h header file, which is used by the mwPointer preprocessor macro. Put this statement in your Fortran source file: #include "fintrf.h" Naming the MEX-File The binary MEX-file name, and hence the name of the function you use in MATLAB, is the name of the source file containing your gateway routine. The file extension of the binary MEX-file is platform-dependent. You find the file extension using the mexext function, which returns the value for the current machine. | | |
| | | |
| | | Computational Routine The computational routine contains the code for performing the computations you want implemented in the binary MEX-file. Computations can be numerical computations as well as inputting and outputting data. The gateway calls the computational routine as a subroutine. The programming requirements described in "Creating and Using Source Files" on page 4-4, "Using MATLAB® Libraries" on page 4-4, and "Required Header Files" on page 4-4 may also apply to your computational routine. | | |
| | | |
| | | Preprocessor Macros The MATLAB preprocessor macros mwSize and mwIndex are used in the mx and mex functions for cross-platform flexibility. mwSize represents size values, such as array dimensions and number of elements. mwIndex represents index values, such as indices into arrays. MATLAB has an additional preprocessor macro for Fortran files, mwPointer. MATLAB uses a unique data type, the mxArray. Because thereisnoway to create a new data type in Fortran, MATLAB passes a special identifier, created by the mwPointer preprocessor macro, to a Fortran program. This is how you get information about an mxArray in a native Fortran data type. For example, you can find out the size of the mxArray, determine whether or not | | |
| | | |
| | | 5-5 | | |
| | | |
| | | | | | | | | | | | |