mexw64-files - MatCont package

20 views (last 30 days)
Daniel
Daniel on 24 Oct 2014
Edited: Abhiram Bhanuprakash on 28 Oct 2014
Hello,
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 Comments
Abhiram Bhanuprakash
Abhiram Bhanuprakash on 27 Oct 2014
Hi Daniel,
From the error message, it looks like MATLAB is crashing when you 'run' the 64-bit MEX files from MatCont package. Can you please share the crash dump file generated by MATLAB, which could throw more light on this issue?
To locate the crash dump file, you can refer to the following article:
Also, as Jan Simon pointed out, can you please elaborate on what you mean by 'running' a MEX file, and why you are doing so?
Daniel
Daniel on 27 Oct 2014
Edited: Daniel on 27 Oct 2014
Hi,
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 ( http://www.mathworks.de/support/compilers/R2014b/index.html ). 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! :)

Sign in to comment.

Answers (2)

Geoff Hayes
Geoff Hayes on 27 Oct 2014
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
matcont
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 on 28 Oct 2014
Edited: Abhiram Bhanuprakash on 28 Oct 2014
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

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!