title: FORTRAN-MATLAB MEX file error
body: <p>This is Subhash. I am having problem in linking fortran-matlab mex files.
  I am running MATLAB R2010a. I am trying to mex fortran subroutines in MATLAB. I have installed MSYS, MinGW and gfortran. I have also downloaded and extracted gnumex in the c:\documents\MATLAB folder. I entered gnumex to run the installation settings. 
  At this point, I see a window pop-up and I entered the following:</p>
  
  <ol>
  <li>MinGW's root directory ---> Pointed towards c:\mingw b) Cygwin's</li>
  <li>root directory -----> left blank c)</li>
  <li>Path to g95.exe ------> c:\mingw\bin</li>
  <li>path to gfortran.exe ------> c:\program files\gfortran\bin e)</li>
  <li>path to gnumex utilities ------>   c:\users.....\matlab\gnumex </li>
  <li>environment linking type ------> MinGW </li>
  <li>generate mex dll or engine-----> mex </li>
  <li>language for compilation -------> fortran 77 </li>
  <li>add stub ------> no </li>
  <li><p>optimization level -----> -O3</p></li>
  <li><p>path for libraries and .def files
  c:\users...\Roaming\MathWorks\MATLAB\R2010a\gnumex</p></li>
  <li><p>Mex options file to create:
  c\users...\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat</p></li>
  </ol>
  
  <p>The above is my installation setup for mex with gnumex. When I hit make options file, an warning message pops out which says
  " cannot corret mex.pl .....
  "cannot open c:...\R2010a\bin\mex.pl for writing"</p>
  
  <p>and when I hit ok, again it pops out saying to confirm overwrite of mexopts.bat .
  I hit confirm and the opt file is created.</p>
  
  <p>At this point I should have my mex setup ready. But, when I run the fortran mex examples xtimesy.f, etc.. ( I use mex filename.f at the command prompt) and I get the following error</p>
  
  <p>g77: getValidInputLinkLibraries: No such file or directory
  c:\prog~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'xtimesy.mexw32' failed.
  Error using ---> mex at 222
  unable to complete successfully.</p>
  
  <p>I tried this uninstalling several times, but ended up with the same error.
  Could anyone please let me know where am I going wrong. Is this not the correct procedure to link the g77? Please throw some light on this.</p>
  
  <p>I appreciate your time..</p>
  
  <p>Thanks.</p>