NAME

README_Matlab - Installation instructions for OOQP Matlab support

This page is part of the OOQP documentation .


INSTALLATION

OOQP may be invoked from within the Matlab environment. Instructions for installing this feature are given here. (This feature is not installed by the standard installation process described in the INSTALL file of the OOQP distribution.)


BEFORE YOU BUILD THE OOQP-MATLAB INTERFACE

Before you attempt to build this interface yourself, we recommend that you search the OOQP web site for a pre-compiled distribution of the required files.

On some machines, it may not be possible to build the OOQP-Matlab interface. The compiler suite and/or libraries available on some systems are simply not compatible with the Matlab executable, and little can be done to fix this other than upgrading some of your software. On other systems, the mex files may be built, but it may require a specific combination of compiler flags and options. See the TROUBLESHOOTING section below for more info.


BUILDING THE OOQP-MATLAB INTERFACE

The Matlab interface requires two types of files: compiled (``Mex'') files and Matlab function (``.m'') files. To compile the required files, first configure and install the OOQP package. Detailed instructions for this procedure are given in the INSTALL file of the OOQP distribution. Briefly, one must invoke the configure script like so.

    ./configure --with-matlab

The option --with-matlab is necessary for configuring Matlab support. If the configure script is unable to configure the Matlab interface, it will print appropriate error messages an create the file src/Mex/DISABLED. If this file is created, you will need to take some further action to configure this module. See the TROUBLESHOOTING section below for details.

Now type

    make all_matlab

to compile all files necessary for the Matlab interface.

The files related to Matlab will be placed in the top-level OOQP directory and will have suffices of the form .mexZZZ where ZZZ are several additional characters that represent the machine type and operating system. For instance, under Linux on an Intel processor, the solver will be named ooqp_mex.mexglx. Several Matlab functions with the suffix .m will also be copied into the top level directory.

Invoke Matlab from within the OOQP directory and type

   help OOQP

at the Matlab prompt to get a listing of available functions. If your OOQP directory isn't named 'OOQP', substitute the appropriate directory name. Help is available for each supplied functions. For instance, help for the default QP solver may be obtained by typing

   help ooqp

To install the Matlab interface in another directory, simply copy all ``.mexZZZ'' and ``.m'' files to the desired directory, and run Matlab from that location.


TROUBLESHOOTING

On all systems, if you are having trouble you should type

   mex -v

to learn which compilers and compiler flags the mex script is using to build mex files. It is often worthwhile to set appropriate environment variables before running configure so that all source files are compiled in the same way. For instance the CXX environment variable can be set to the name of an alternate C++ compiler. The names of these variables loosely follow the naming conventions used by GNU make. See the ``Variables Used by Implicit Rules'' section of the online manual for GNU make that may be found at http://www.gnu.org/manual/.

If you have already run configure delete the config.cache file. It is never harmful to remove this file, but is only necessary when you are making major changes to the configuration such as changing the C++ compiler.

To configure this package, you may need to set the MEX and/or MATLABEXE environment variables before running configure.

Back to the Documentation Roadmap .