Print this article Edit this article
Using CPLEX with Matlab
Lanch matlab like you normally do from an ECN Linux machine. In the matlab command shell window add the CPLEX folders with the addpath command:
>> addpath /opt/cplex/current/cplex/matlab
>> addpath /opt/cplex/current/cplex/examples/src/matlab
Use the "ver" command to verify the CPLEX toolbox is now available:
>> ver
-------------------------------------------------------------------------------------------------------
MATLAB Version: 8.1.0.604 (R2013a)
MATLAB License Number: 819994
Operating System: Linux 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------------------------
MATLAB Version 8.1 (R2013a)
Simulink Version 8.1 (R2013a)
Aerospace Blockset Version 3.11 (R2013a)
Aerospace Toolbox Version 2.11 (R2013a)
Bioinformatics Toolbox Version 4.3 (R2013a)
CPLEX Toolbox Version 12.5.1
Communications System Toolbox Version 5.4 (R2013a)
Control System Toolbox Version 9.5 (R2013a)
Curve Fitting Toolbox Version 3.3.1 (R2013a)
..etc...
The CPLEX toolbox is now available. To save those new path settings for future sessions you need to save the settings to the file pathdef.m with the savepath command. Matlab will look for that file in the directory you start matlab from. In this case, my home directory(~moyman):
>> savepath ~moyman/pathdef.m
Now the next time I start up matlab from my home directory it will load the CPLEX folders automatically. If I start it up from a different directory I would need to manually add the folders again. I can move the pathdef.m file to whatever directory I want via a UNIX command shell (mv). The only requirement for matlab to read that file is that you start it up from the same directory the pathdef.m is located at.
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
Jan 21, 2014 1:24 pm US/Eastern
by
admin
JumpURL: