Using mex to compile fortran code

I have Matlab R2012b (8.0.0.783) 64bit (maci64) installed in a Mac OS X (10.8.8) - Snow leopard. For compiling FORTRAN I have installed the GNU gfortran 4.3.4 which according to http://www.mathworks.com/support/compilers/R2012b/maci64.html is supported by my matlab's version.
I have coded the mexopt.sh file in order to allow matlab to find the gfortran as follows:
FC='/usr/local/bin/gfortran'
FFLAGS='-fexceptions -m64 -fbackslash'
FC_LIBDIR='/usr/local/lib/'
FC_LIBDIR2='/usr/local/lib/gcc/x86_64-apple-darwin/4.3.4/'
FLIBS="\$MLIBS-L\$FC_LIBDIR"
FOPTIMFLAGS='-O5 -funroll-loops -ftree-vectorize'
LDDEBUGFLAGS='-g'
Without this workaround I got the message gfortran: unknown command, although through the terminal I was able to run gfortran.
Meanwhile, when trying to compile the example timestwo.F (from matlab examples) by making
mex timestwo.F
I get the following error: -o: command not found which I think is related to the linking process since by just compiling
mex -c timestwo.F
Can someone who has more experience and knowledge help me out? I would be grateful.
Thanks in advance.
Ricardo

Réponses (0)

Catégories

En savoir plus sur MATLAB Compiler dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by