MATLAB Answers

0

mex File not Recognized

Asked by Marcelo Sena on 7 Feb 2015
Latest activity Answered by 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.

  0 Comments

Sign in to comment.

Tags

2 Answers

Jan
Answer by Jan
on 7 Feb 2015
Edited by 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

I managed to do the setup, but my original problema remains, that is, when I call the mex file MatLab tells me it cant find the file. Any hint?
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
Answer by 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.

  0 Comments

Sign in to comment.