mex File not Recognized

78 views (last 30 days)
Marcelo Sena
Marcelo Sena on 7 Feb 2015
Answered: James Tursa on 7 Feb 2015
Hi, I am using a MatLab 2013a 32-bit. I am trying to call a mex file 'SMAT_matlabcall.mexw32',but it gives me the error:
Invalid MEX-file
'C:\Users\...\SMAT_matlabcall.mexw32': The
specified module could not be found.
However, the mex file is indeed in the correct path. Since I just installed MatLab, maybe the issue was with mex setup. When trying to run
mex setup
I get the error:
C:\PROGRA~2\MATLAB\R2013A\BIN\MEX.PL: Error: 'setup' not found.
Error using mex (line 206)
Unable to complete successfully.
I have compilers installed in my computer since I am able to run mex files in a MatLab 64-bit version, but for other reasons I need to run these files in the 32-bit version.
Any help is appreciated. Thanks.

Answers (2)

Jan
Jan on 7 Feb 2015
Edited: Jan on 7 Feb 2015
The command for the setup is:
mex -setup
with the minus character.
Use the DependencyWalker to check, if the required run-time libraries are installed. Perhaps you have to install the MSVC run time libs in the 32 bit version in addition. See http://www.mathworks.com/matlabcentral/answers/95906-how-do-i-profile-my-exe-or-dll-file-with-dependency-walker
  2 Comments
Jan
Jan on 7 Feb 2015
Do you mean the message "The specified module could not be found."? No, this does not mean, that the file is not found, but that a library is missing. So please post, if you have been able to compile the function successfully and if the DependencyWalker is satisfied.

Sign in to comment.


James Tursa
James Tursa on 7 Feb 2015
As Jan has already pointed out, "The specified module could not be found" message means that the SMAT_matlabcall.mexw32 file itself is in fact found, it is just that there is a problem when attempting to run it.
In addition to a missing library, the error message can result when a mex routine compiled in one version of MATLAB is used in a different version of MATLAB (the MATLAB libraries used by the mex routine are incompatible). The only fix is to use the mex routine in the original version of MATLAB, or to recompile the mex routine in the new version of MATLAB.

Tags

Community Treasure Hunt

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

Start Hunting!