How to operate cplex on matlab?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Doobie
am 13 Apr. 2017
Kommentiert: Doobie
am 18 Apr. 2017
I'm trying to run cplex on matlab but I'm getting the following error:
Error using cplexlp (line 256)
Invalid MEX-file 'C:\Program
Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64\cplexlink1271.mexw64': The specified
procedure could not be found.
Error in cplex_example (line 12)
x = cplexlp(f,A,b,Aeq,beq,lb,ub,options);
I have already added cplex path as below:
>> addpath ('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64')
>> addpath('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\examples\src\matlab')
>> savepath
and installed all editions of Microsoft Visual C++ Redistributable packages (both x64 and x86 just to make sure).
My laptop runs on Windows 10 with 64-bit; my matlab is R2013a 64-bit.
I'm really at my wit's end here. Any sort of info is greatly appreciated.
0 Kommentare
Akzeptierte Antwort
Darshan Ramakant Bhat
am 17 Apr. 2017
This issue can arise if the MEX-file depends on a shared library that also ships with MATLAB. This is an unsupported workflow and is never guaranteed to work, but if it is to have any chance of working, the MEX-file and its dependencies must be built against the same version of the library as is shipped with MATLAB. The MEX-file may try to use the shipped version of the library at run-time, and if this is different from the version used in building the MEX-file, MATLAB may throw the above error, or even crash.
On Windows machines, you can investigate whether the issue is due to conflicting shared libraries by using Dependency Walker. This is a third-party program available at
www.dependencywalker.com
After downloading Dependency Walker, take the following steps: Launch MATLAB
Navigate to the directory containing the Dependency Walker executable (depends.exe) Execute the following command at the MATLAB prompt
>> !depends.exe full path to MEX-file
The left-hand pane of Dependency Walker will show where each DLL is loaded from (you may need to right-click on the pane and select "Full paths"). Look for entries with a red icon a file path in the MATLAB file hierarchy.
For each such entry, scroll through the upper right pane of Dependency Walker and look for red icons in the left-most column. These indicate function calls for which the external and shipped versions of the DLL differ. The presence of such differences means that a library conflict is probably the cause of the error message or crash.
There are three potential workarounds. To describe them, I consider the case where "myMex.mexw64" is linked against "myLibrary.dll" which is linked against "conflict.dll". MATLAB ships with v. 1.1 of "conflict.dll," but "myLibrary.dll" was built using v. 1.0. The version of a DLL-file can sometimes be found on the "Details" tab of the "Properties" window for that file. The potential workarounds are:
1.Use the same version of "conflict.dll":
If you have access to the source code for "myLibrary.dll" as well as the header-files for v 1.1 of "conflict.dll", you can rebuild "myLibrary.dll" using v 1.1 of "conflict.dll." This may require changes to the "myLibrary" source code. Note that sometimes the DLL files may differ even though they have the same version number, which can
2.Rename the external version of "conflict.dll":
If you have access to the source code for "myLibrary.dll" as well as the header-files for v 1.0 of "conflict.dll", you can rename the external copy of "conflict.dll" to "conflict_external.dll," and rebuild "myLibrary.dll" such that it is linked against "conflict_external.dll". This could prove to be difficult if there are multiple conflicts.
3.Use a different MATLAB relesase:
Use a release of MATLAB that ships a version of "conflict" for which the DLL name is different. This is what made R2011b work in the OpenSceneGraph case described above.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!