BannerHauptseite TUMHauptseite LehrstuhlMathematik SchriftzugHauptseite LehrstuhlHauptseite Fakultät

How to install and compile the MEX interfaces

There are three methods (alternatives) to install and use the MEX files.

With MATLAB and mex -setup

This is possible if you have a C and Fortran compiler installed which are both supported by MATLAB. "Bind" both compilers to MATLAB typing
mex -setup
at the MATLAB command prompt and choose the right option files (more information can be found at the Mathworks Support Pfeil). You have to do this step only once.

To check if everything is prepared for compilation type
mex -v
If you get a list with a C-compiler (CC) and a Fortran compiler (FC) you have everything you need. Here is an example: mexconfig.txt.

Then you can install a MEX Interface:
  1. unpack zip-File with the interface in an empty folder
  2. Start MATLAB and change to this directory
  3. call "compile", i.e. type "compile" at the MATLAB command prompt
  4. if there are no errors, you have got at least one .mexsol file (solaris) or one .dll file (Windows, MATLAB<7.1) or one .mexw32 file (Windows, MATLAB>=7.1)
  5. Now you have two possibilities for using the interface: Either you add the directory from 1. to MATLAB's search-paths or you copy the .mexsol or .dll and .m files in the directory you want to use them

With lcc-win32

This is possible if you have a Windows-PC.
  1. Visit http://www.cs.virginia.edu/~lcc-win32/ Pfeil or http://q-software-solutions.de/products/lcc-win32/index.shtml Pfeil
  2. Download lccwin32.exe (at the moment 3.9 Mb)
  3. Download fortran.exe (at the moment 0.5 Mb) at [http://www.filewatcher.com/m/fortran.exe.453574.0.0.html]]
  4. Install lccwin32.exe (if possible DON'T USE spaces in your installation-path, e.g. C:\lcc)
  5. Install fortran.exe at the exact same location (in our example C:\lcc)
  6. unpack the zip file with the interface in an empty folder
  7. change in this directory, open a editor of your choice and edit create.bat. You have to put in two paths (one for MATLAB and one for lcc)
  8. start create.bat at a Dos Command Prompt (Dos-Box)
  9. if there are no errors, you have got at least one .dll file
  10. Now you have two possibilities for using the interface: Either you add the directory from 6. to MATLAB's search-paths or you copy the .dll and .m files in the directory you want to use them

With OpenWatcom 1.3

This is possible if you have a Windows-PC and your MATLAB version supports OpenWatcom 1.3. To check: go in the directory
<MATLAB-Path>/extern/lib/win32/watcom
If there is a subfolder openwc13 then OpenWatcom 1.3 ist supported.
  1. Visit http://openwatcom.mirrors.pair.com/ Pfeil
  2. Dowload open-watcom-win32-1.3.exe Pfeil
  3. Install OpenWatcom 1.3
  4. unpack the zip file with the interface in an empty folder
  5. change in this directory, open a editor of your choice and edit create_wc.bat. You have to put in two paths (one for MATLAB and one for Watcom)
  6. start create_wc.bat at a Dos Command Prompt (Dos-Box)
  7. if there are no errors, you have got at least one .dll file
  8. Make sure the Watcom folders binnt and binw are listed (in that order) in the PATH environment variable and start MATLAB
  9. Now you have two possibilities for using the interface: Either you add the directory from 4. to MATLAB's search-paths or you copy the .dll and .m files in the directory you want to use them

Some words about Cygwin, MingW and Gnumex

It's far behind the scope of this HowTo to explain the installation of Cygwin and/or MingW together with Gnumex. Take a look at the Gnumex homepage Pfeil. Instead I'll give here some hints that may help you to compile and link this MEX interfaces with gnumex.

This option file (mexmingf.bat) worked for me. For example I compiled the Radau interface with

mex -v -f c:\gnumex\mexmingf.bat -DFORTRANUPP -DFORTRANNOUNDER radauMex.c options.c radau.f lapack.f lapackc.f dc_lapack.f

Questions, Problems, Bugs

Send them to ludwigematma.tum.de