Installation

 
In order to use the MOSEK optimization toolbox for MATLAB, you must install the MOSEK optimization tools. Please see Chapter 1 in the MOSEK installation manual for details on how to install MOSEK. An online version is available at

6.1 Locating the toolbox functions

By default MATLAB cannot locate the MOSEK optimization toolbox functions. Therefore you must execute the addpath command within MATLAB to change the so-called matlabpath appropriately. Indeed matlabpath should include a path to the MOSEK optimization toolbox functions. The next subsections show how to use addpath.

6.1.1 On Windows

If you are using Windows you should do
  1. % For versions R2009b to R2011b  
  2. addpath 'c:\Program Files\mosek\7\toolbox\r2009b'  
  3.  
  4. % For versions R2012a and R2012b  
  5. addpath 'c:\Program Files\mosek\7\toolbox\r2012a'  
  6.  
  7. % For R2013a or newer  
  8. addpath 'c:\Program Files\mosek\7\toolbox\r2013a'  
This assumes that you installed MOSEK at
  1. c:\Program Files\ 
If this is not the case, you will have to change the path given to addpath.

6.1.2 On Linux/UNIX/MAC OS X

If you are using UNIX or a UNIX-like operating system you should do
  1. % For versions R2009b to R2011b  
  2. % These versions are not supported on MAC OSX.  
  3. addpath '/home/user/mosek/7/toolbox/r2009b'  
  4.  
  5. % For versions R2012a and R2012b  
  6. addpath '/home/user/mosek/7/toolbox/r2012a'  
  7.  
  8. % For versions R2013a or newer  
  9. addpath '/home/user/mosek/7/toolbox/r2013a'  
This assumes that MOSEK is installed at
  1. /home/user 
If this is not the case, you will have to change the path given to addpath.

6.1.3 Permanently changing matlabpath

Normally, you will have to enter the addpath command every time MATLAB is started. This can be avoided if the addpath command is added to
  1. <matlab>toolbox\local\startup.m 
where <matlab> is the MATLAB root directory. Alternatively the permanent modification of the MATLAB path can be performed using the
  1. \File\Set Path 
menu item.

6.2 Verifying that MOSEK works

You can verify that MOSEK works by executing
  1. mosekdiag 
in MATLAB. You should get a message similar to this:
  1. Matlab version: 7.13.0.564 (R2011b) 
  2. Architecture : GLNXA64 
  3. The mosek optimizer executed successfully from the command line: 
  4.  
  5. MOSEK Version 7.0.0.78 (Build date: 2013-8-13 14:11:04) 
  6. Copyright (c) 1998-2013 MOSEK ApS, Denmark. WWW: http://mosek.com 
  7. Global optimizer version: 8.0.868.287. Global optimizer build date: Jan 21 2013 10:42:51 
  8. Barrier Solver Version 7.0.0.078,  
  9. Platform Linux 64x86 (D). 
  10.  
  11. FlexLM 
  12. Version : 11.11 
  13. Hostname : gram 
  14. Host ID : "bc305bea244f bc305bea2450" 
  15. Search path : /home/someuser/mosek/7/mosek.lic 
  16.  
  17. Operating system variables 
  18. MOSEKLM_LICENSE_FILE : /home/joachim/mosekprj/generic/license/1000.lic 
  19. LD_LIBRARY_PATH : 
  20. /remote/public/matlab/r2011b/sys/os/glnxa64 
  21. /remote/public/matlab/r2011b/bin/glnxa64 
  22. /remote/public/matlab/r2011b/extern/lib/glnxa64 
  23. /remote/public/matlab/r2011b/sys/java/jre/glnxa64/jre/lib/amd64/native_threads 
  24. /remote/public/matlab/r2011b/sys/java/jre/glnxa64/jre/lib/amd64/server 
  25. /remote/public/matlab/r2011b/sys/java/jre/glnxa64/jre/lib/amd64 
  26.  
  27. *** No input file specfied. No optimization is performed. 
  28.  
  29. Return code - 0 [MSK_RES_OK] 
  30.  
  31. mosekopt: /home/someuser/mosek/7/toolbox/r2009b/mosekopt.mexa64 
  32. mosekopt is working correctly. 
  33. MOSEK Fusion is working correctly. 
If you do not get this message, please read Section 6.3.

6.3 Troubleshooting

6.3.1 Undefined function or variable ’mosekopt’

If you get the MATLAB error message
  1. Undefined function or variable 'mosekopt' 
you have not set up the matlabpath correctly as described in Section 6.1.

6.3.2 Invalid MEX-file

For certain versions of Microsoft Windows and MATLAB, the path to the MEX files cannot contain spaces. If you installed MOSEK in
  1. C:\Program Files\Mosek 
and get a MATLAB error from mosekopt:
  1. Invalid MEX-file 'C:\Program  
  2. Files\Mosek\7\toolbox\r2012a\mosekopt.mexw64' 
Then try installing MOSEK in a different directory, for example
  1. C:\Users\someuser\mosek 

6.3.3 Output arguments not assigned

If you encounter an error like
  1. Error in ==> mosekopt at 1 
  2. function [r,res] = mosekopt(cmd,prob,param,callback) 
  3.  
  4. Output argument "r" (and maybe others) not assigned during call to 
  5. "C:\Users\someuser\mosek\7\toolbox\r2009b\mosekopt.m>mosekopt". 
then there is most like a mismatch between 32 and 64 versions of MOSEK and MATLAB.
From MATLAB type
  1. >> which mosekopt 
which (for a succesful installation) should point to a mex file,
  1. C:\Users\someuser\mosek\7\toolbox\r2009b\mosekopt.mexw64  
and not a MATLAB .m file,
  1. C:\Users\someuser\mosek\7\toolbox\r2009b\mosekopt.m