Cannot find MEX function when executing C

System
  • Ubuntu running R2010a
Error
  • Undefined function or method 'mex' for input arguments of type 'char'.
Compilation call
/usr/local/matlab/bin/mcc -m -v -R -nodisplay remote_estimation.m
Context
  • Compiling .m file that has the follwing code:
function remote_estimation()
%#function mex
mex('/path/to/file.c');
When executing in matlab it works, after compiling and executing the binary, it gives the error described above

 Akzeptierte Antwort

Jan
Jan am 1 Feb. 2012

0 Stimmen

The mex command does not perform magic tricks, it simply starts the compiler. Unfortunately mex has grown to a very obfuscated piece of code since Matlab 4. It are some M-, Perl- and BAT-files, while the last are not executed, but parsed by teh Perl functions.
If you find out the parameters used for starting the compiler, you can start the compiler by a single system call also.

2 Kommentare

André
André am 23 Mai 2012
thanks, that works.. it brings a new problem, but solves this question
André
André am 23 Mai 2012
new problem: http://www.mathworks.com/matlabcentral/answers/39246-error-when-executing-in-runtime-mex-compiled-file-also-in-runtime-c-standalone

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Kaustubha Govind
Kaustubha Govind am 1 Feb. 2012

0 Stimmen

It is likely that the "mex" command is not supported for deployment. Is there a reason that you can't simply include your MEX-file with your application's CTF archive (using the mcc -a option)? Since the compiled application is platform-specific, the MEX-file from your machine should be sufficient on all target machines.

2 Kommentare

André
André am 1 Feb. 2012
The code does not call a static file. The application uses a toolbox that needs to dynamically create the mex file (based on the given arguments).
As such, I really need for the 'mex' command to be accessible during run-time.
Walter Roberson
Walter Roberson am 1 Feb. 2012
Does the generated mex code call the MATLAB routines, or is it pure C and OS calls? If it is pure C and OS calls, then can the toolbox emit C without the the mex headings, in a form that you could call upon a C compiler and generate a dynamic library that you could loadlibrary() on ?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 1 Feb. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by