MATLAB compiler notes
for Solaris at SLAC Method 1

Accelerator Department

Modified Friday, 16-Sep-2005 20:21:32 PDT

Introduction

SLAC owns one Matlab compiler license that can be used on Solaris as well as Windows. For Windows machines, you can use Matlab 6.5 or Matlab 7 to compile programs at the Matlab prompt. The following Matlab C compiler command will compile a Matlab program with GUIs.

>> mcc -B sgl

Note that Matlab will need to be installed on the Windows machine where you want to run the compiled version. Compilation eliminates the need for a Maltab license.

For Solaris machines follow the instructions below.

The CompileMatlab area contains a directory structure that can be used to compile Matlab functions.

Set up and Compiling

    To setup your own area:

  1. - modify your .cshrc file to include:

    setenv MATLAB_VER 13

  2. - Copy directory structure:

    cp -r /afs/slac.stanford.edu/www/grp/ad/op/unix_help/matlab/CompileMatlab    ~/[your work area]/.

    this creates the following directorie tree:
          65        +-- CompileMatlab
           5        |         +-- src
          15        |         +-- bin
          13        |         |    +-- solaris
          33        |         +-- config
           2        |         +-- javalib
    

    Note: The src directory contains a file Hello_Example.m; this function can be compiled at this point by issuing the gmake command from this directory.

    (This may be a good test to verify that your environment is setup for compiling Matlab. Look carefully at the error messages. If the compiler license has been used in the past hour by another user, you will not be able to compile. issue the 'lmstat matlab' command to see license availability.)


  3. - Move files to be compiled into src directory

    cp ~/[yourMatlabFn]    ~/[your work area]/CompileMatlab/src/.
    (Or create yourMatlabFn.m in this ~/[your work area]/CompileMatlab/[yourOwnMatlabDir] directory. If you use [yourOwnMatlabDir] instead of src, you will need the to copy the Makefile and Makefile.Host files to [yourOwnMatlabDir] from src)

  4. - Modify Makefile.Host

    Edit the following lines:

  5. - issue gmake command from [yourOwnMatlabDir] or the src directory.
    If gmake succedees many files are created:

    .../bin/solaris
    This directory will have the binary executable.  At this point if you have and .figs, this would be a good time to copy them into bin/soloaris.

    .../src/O.solaris
    The O.solaris directory will have the .h and .c files created by the Matlab C compiler (mcc). It will also have a .log file with compiler messages and warnings.

  6. - Cleaning up

    gmake clean
    This command will remove the 0.solaris directory. These files are not need after a successful build.

Maintained by Matt Boyes and William Colocho