Error when executing in runtime mex compiled file (also in runtime) - C standalone

System
Ubuntu running R2010a
Error
"Error using ==> feval Undefined function or method '<generated filename>'
Compilation call
/usr/local/matlab/bin/mcc -m -v -R -nodisplay remote_estimation.m
Context
The goal is to compile a mex file during a standalone C runtime from a
set of parameters and then run it.
Compiling .m file that has the follwing code:
function remote_estimation()
(...)
addpath(tempdirSB); % add destination directory for compiled mex to path
system(sprintf('mex -I''%s'' %s.c ''%s'';',includefolder,filename,libpath));
feval(filename,'parameters'); % <-- error
When executing in matlab it works, after compiling and executing the binary, it gives the error described above

Risposte (2)

My guess is that the MEX command is failing. (I'm not even sure how the MEX command words in deployed MATLAB code). Perhaps you should use the system command with the two output arguments "status" and "result" and print them to see if there is an error message.
[EDITED, reposted to clear the accidental acceptance]
"system('mex ...')"? system() calls a command of the operating system, but I assume you want the M-function "mex". I assume you need the "gcc" calling sequence inside the system() call.
Are the < and > characters in the error message mean, that you have removed the original name to omit unnecessary information, or do you really wan to call a function, which contains such characters?

3 Commenti

Andre has written:
clicked on the wrong button to accept the answer, the <..> is just a random name that is generated, for example "tp1311jsdq131"
the M-function "mex" is not accessible in a standalone executable, in a matlab environment this code (with the system call) works as expected, the problem is when I run the executable that does not recognize the feval(...) function
Jan: There is a system command "mex" also that ships with MATLAB, so it is perfectly acceptable to call system('mex ...'). For example, you could try this at your MATLAB prompt:
>> system('mex -help')
Andre: Could you try the debugging step I suggested?

Accedi per commentare.

Categorie

Prodotti

Richiesto:

il 23 Mag 2012

Community Treasure Hunt

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

Start Hunting!

Translated by