mexw64-files - MatCont package

조회 수: 2(최근 30일)
Daniel 2014년 10월 24일
편집: Abhiram Bhanuprakash 2014년 10월 28일
I've been trying the dynamical systems package MathCont to work on my PC (Windows 8, 64-bit), but somehow the mexw64 files aren't helping me. I downloaded them from
but running them in Matlab throws an error (see attached jpeg).
I should add that I am not familiar with mex-files of any sort, so maybe I am just making some 'obvious' mistake. Other blogs and Q&A's haven't helped so far.
Thanks for any sort of help! :)
  댓글 수: 5
Daniel 2014년 10월 27일
편집: Daniel 2014년 10월 27일
I attached one of the crash files (there are actually four, since I tried it multiple times). Note that had to rename it to a .txt file to upload it.
Concerning the 'running' of a mex-file. I've never before used mex-files and my aim is as follows:
Download mexfiles for Matcont ~> do something with these files ~> Run Matcont in Matlab.
In my case the 'something' in between first had to include understanding what mex-files are, but I believe I still haven't. What I've gathered from reading (please correct me if I'm wrong!!) they are compiled files (for example originally written in C), which then also 'work' in Matlab. The working bit somehow eludes me though. I tried 'running' them by navigating to the folder where they are and then simply typing their name in the command line in Matlab (just like calling a function). That did not work, but rather caused the above mentioned error. Then I tried 'decompiling' them in a sense, but I couldn't install SDK-compiler suggested by Matlab ( ). So I'm sorta stuck with mex-files which should do the trick but I don't see how.
Thanks for the help already given and any further advice! :)

댓글을 달려면 로그인하십시오.


Geoff Hayes
Geoff Hayes 2014년 10월 27일
Daniel - you are correct in thinking that the MEX files are built from C (or C++ or Fortran) code that you can then call from your MATLAB programs. In your case, the MEX file that you are trying to run, BVP_BPC_jacC is built from the C function matcont5p4/LimitCycle/BVP_BPC_jacC.C. This file (and the others) are built when I type the following in the Command Window from the matcont5p4 (the version that I downloaded) folder
If I then change directory to matcont5p4/LimitCycle, I will see the C file and the MEX function (BVP_BPC_jacC.mexmaci64, since I am running MATLAB on a Mac). If I then try to run this function (like you), then I observe a crash as well.
This behaviour, while undesirable, is expected as the C code is making certain assumptions about its input parameters. Since you are not passing any, then the code tries to access data that doesn't exist and so crashes. (Some checks could have been added to make sure that the correct number of parameters were being passed before it tried to make use of the parameters.)
This MEX function (and the others) should only be called from within the context of the matcont software, and not outside of it (unless you know what inputs each expects).

Abhiram Bhanuprakash
Abhiram Bhanuprakash 2014년 10월 28일
편집: Abhiram Bhanuprakash 2014년 10월 28일
Hi Daniel,
I am adding to what Geoff Hayes mentioned in his answer above.
Yes, you are right. MEX stands for MATLAB Executable, and this means that you can create a MEX file from a C/C++/Fortran code and run it in MATLAB. However, to do this, you would need to have a supported compiler, which in this case is Windows SDK 7.1.
To install Windows SDK 7.1, please refer to the article here
From the crash dump, I think you have two issues:
1. As Geoff said, you need to give input arguments to the MEX function which you call.
2. You need to have a suported compiler installed, and point MATLAB to it.
After installing Windows SDK 7.1, you can point MATLAB to use it, by entering the following line of code in your Command Window:
>> mex -setup
For more information on 'mex' command, refer to the documentation here and here


Community Treasure Hunt

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

Start Hunting!

Translated by