External Interfaces/API    

Testing Your Configuration on UNIX

The quickest way to check if your system is set up properly to create MEX-files is by trying the actual process. There is C source code for an example, yprime.c, and its Fortran counterpart, yprimef.F and yprimefg.F, included in the <matlab>/extern/examples/mex directory, where <matlab> represents the top-level directory where MATLAB is installed on your system.

To compile and link the example source files, yprime.c or yprimef.F and yprimefg.F, on UNIX, you must first copy the file(s) to a local directory, and then change directory (cd) to that local directory.

At the MATLAB prompt, type

This uses the system compiler to create the MEX-file called yprime with the appropriate extension for your system.

You can now call yprime as if it were an M-function.

To try the Fortran version of the sample program with your Fortran compiler, at the MATLAB prompt, type

In addition to running the mex script from the MATLAB prompt, you can also run the script from the system prompt.

Selecting a Compiler

To change your default compiler, you select a different options file. You can do this anytime by using the command

Select the proper options file for your system by entering its number and pressing Return. If an options file doesn't exist in your MATLAB directory, the system displays a message stating that the options file is being copied to your user-specific matlab directory. If an options file already exists in your matlab directory, the system prompts you to overwrite it.

Using the setup option resets your default compiler so that the new compiler is used every time you use the mex script.


  Building MEX-Files Testing Your Configuration on Windows