mex command not found in unix command line
18 views (last 30 days)
Show older comments
Hi all,
I need to use the mex command from the unix command line. However, this command is not found in my unix terminal. Note that it is available within the matlab command line.
I would like to create a symbolic link to it within my PATH. Where is this command(/unix executable?) stored?
Thanks!
Chris
0 Comments
Answers (2)
Jan
on 11 Jul 2011
Sorry, Chris, this will not work as far as I know. MEX is a Matlab command. You cannot call it from the Unix shell directly, but you can instruct Matlab to do this for you:
matlab -r "mex -O YourCFile.c"
But finally I do not see the reason to do it: The only thing done by MEX is a very obscure way to call the compiler, e.g. GCC. Therefore I assume it would be much easier, if you call GCC directly.
0 Comments
Titus Edelhofer
on 11 Jul 2011
Hi Jan,
sorry but that's not correct: on Linux you can call mex from MATLAB but you have mex as a shell script as well. The MATLAB mex command on unix is just calling the external shell script.
Chris: you will find the mex shellscript in MATLAB/bin (just where the MATLAB executable is as well).
Titus
3 Comments
Titus Edelhofer
on 11 Jul 2011
Hi Jan,
it depends: my standpoint is, that my colleagues who write the mexopts files do know much more about compiler flags then I do. Indeed, sometimes I helped out customers trying to call GCC with "their" set of compiler options and flags and failing in the end, where the only thing to do was just call mex with standard options (if from within MATLAB or from outside made no difference) to make it working smoothly ...
Titus
Jan
on 11 Jul 2011
I vote for a simplified MEX function. I cannot see the reason for a conglomerate of M, Perl and shell scripts, for such a straight task as calling the compiler. Adjusting the mexopts file for a not supported compiler, e.g. a modern or 64 bit version of LCC, is a mystic procedure. The bunch of FEX submissions concerning instructions for creating and debugging Mex files is a strong indicator for the need of a simplification.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!