I would like to create MEX files from Fortran 90 source code. How can I do this?
Best Answer
For MATLAB 6.5 (R13), we are shipping an options file called f90opts.sh for Fortran 90 source code on Unix. This options file is able to compile fixed format Fortran 90 source code. You can set up this options file by using the following code:
mex -setup
and selecting f90opts.sh.
Similarly, on the PC, there is a df65opts.bat file that can be selected. This file is the same as the df60opts.bat file, except that it now can use the fpp (fortran preprocessor). Note however that Fortran 90 is already supported in both Visual Fortran 6.0 and 6.5 for MATLAB R12.1. Therefore Fortran 90 is already supported on the PC. This file can be invoked as follows:
1. The Fortran 90 compiler for Linux we looked at was Vast Fortran 90, which is essentially a translator from Fortran 90 to Fortran 77. Consequently, on Linux, we only have Fortran 77 support.
2. In the event that you prefer to use the free form source code rather than the fixed form, please remove the -fixed or -qfixed flag from the f90opts.sh options file for your architecture.
The MEX options file for Intel Fortran Composer XE 2011 with Microsoft Visual Studio 2010 professional linker points to the wrong installation directory in 64-bit MATLAB 7.13 (R2011b).
Workaround:
Edit the intelf12msvs2010opts.bat file:
1. Open $MATLABROOT$\bin\win64\mexopts\intelf12msvs2010opts.bat
Best Answer