Why does MATLAB crash when I run code using IBM's MATLAB-CPLEX Connector?

185 views (last 30 days)
Why does MATLAB crash with a stack trace containing the following lines when I run my code containing calls to CPLEX in R2016b or later?
Note that this crash only occurs if I use MATLAB R2016b or later. The code runs to completion on earlier versions of MATLAB.
[0] 0x000000018000d360 matrix::detail::noninlined::mx_array_api::try_destroy_container at b:\matlab\src\matrix\array2.cpp:2807
[1] 0x000000018000bcdf intrusive_ptr_release at b:\matlab\src\matrix\undoc.cpp:1940
[2] 0x0000000018be40e3 MathWorks::lxe::TypeConstructorMxarrayBase::DestroyValue at b:\matlab\src\lxe\types\typemxarray.cpp:132
[3] 0x0000000018be8944 MathWorks::lxe::TypeConstructorXvalue::ResetValue at b:\matlab\src\lxe\types\typexvalue.cpp:47
[4] 0x0000000016a6ce6f MathWorks::lxe::UniqueIrPointerTypeConstructor::ResetValue at b:\matlab\src\lxe\m_lxe\type\typeirpointer.cpp:208
[5] 0x0000000018beb5c7 MathWorks::lxe::TypeConstructorTuple::ResetValue at b:\matlab\src\lxe\types\typetuple.cpp:346

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Apr 2019
Edited: MathWorks Support Team on 4 Apr 2019
This issue is related to incompatibilities between the CPLEX MEX functions and recent versions of MATLAB. Note that the MATLAB connector from CPLEX is tested for the available versions of CPLEX at development time. As such, each version of CPLEX is only guaranteed to be compatible with a subset of MATLAB releases. For example, CPLEX version 12.7.0 is only guaranteed to be compatible with MATLAB R2014b to R2016a, while 12.7.1 should work with R2015a until R2017a. A detailed compatibility report can be generated from IBM’s website at the link below:
If this issue arises, it is recommended that you upgrade to CPLEX version 12.7.1.
If the issue persists after the upgrade, or if you are unable to upgrade CPLEX, please contact MathWorks technical support for further assistance.

More Answers (2)

TUT Student
TUT Student on 11 Feb 2022
Hi there
I am currently using MATLAB 2021b and I am facing the same problem.
Please, can anyone assist ?

Sign in to comment.

Giovanni Ponce
Giovanni Ponce on 26 May 2022
Has anyone succesfully installed CPLEX on MATLAB? Please comment below what version of MATLAB and CPLEX you used
  1 Comment
Eunji Kwon
Eunji Kwon on 18 Jun 2022
I am using cplex 12.10 on MATLAB 2020b and it works well.
(With cplex 12.10, I faced the same problem at matlab 2021b and 2022a)

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!