problems compiling mex file in MATLAB R2009b using

Hi,

My problem is that I have been unable to create a Fortran-based mex file in MATLAB because of failure to compile and/or link the source files. I am testing a very simple example (given below).

My setup is:

Hardware: new MaxBook Pro
OS: OS X 10.6.2
Developer software: XCode 3.2
Application: MATLAB R2009b
Fortran Compiler: Intel Professional 11.1 trial copy
Previous compiler: gfortran 4.2.3 from r.research.att.com/tools/

This was my first attempt to create mex files, so initially I installed a version of gfortran and had no success getting it to compile. I edited the mexopt.sh file etc as per various user posts I could find, still no luck. Finally I uninstalled gfortran using the terminal commands and restored the original mexopt.sh file from a backup copy.

Then I obtained a trial copy of Intel Fortran Compiler Professional 11.1 and installed it apparently without problems.

I used the "mex -setup" command from within MATLAB in the command window:

>> mex -setup

Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.

Using the 'mex -setup' command selects an options file that is
placed in ~/.matlab/R2009b and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in ~/.matlab/R2009b.

To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).

The options files available for mex are:

1: /Applications/MATLAB_R2009b.app/bin/gccopts.sh :
Template Options file for building gcc MEX-files

2: /Applications/MATLAB_R2009b.app/bin/mexopts.sh :
Template Options file for building MEX-files via the system ANSI
compiler

0: Exit with no changes

Enter the number of the compiler (0-2):

I entered "2".

Next I ran this simple test of the compiler:

mex yprimef.F yprimefg.F
yprimef(1,1:4)

which gave the output

/Applications/MATLAB_R2009b.app/bin/mex: line 997: gfortran: command
not found

mex: compile of ' "yprimef.F"' failed.

??? Error using ==> mex at 221
Unable to complete successfully.

Apparently gfortran is still lurking in there somwewhere, or I have failed to point things to the correct directory somwhow, etc.

Any thoughts?

Thanks