mex command not found in unix command line

조회 수: 18 (최근 30일)
Chris
Chris 2011년 7월 11일
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

답변 (2개)

Jan
Jan 2011년 7월 11일
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.

Titus Edelhofer
Titus Edelhofer 2011년 7월 11일
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
Titus Edelhofer
Titus Edelhofer 2011년 7월 11일
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
Jan 2011년 7월 11일
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.

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by