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

답변 (2개)

Kaustubha Govind
Kaustubha Govind 2012년 5월 23일
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.
Jan
Jan 2012년 5월 24일
[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

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?

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

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2012년 5월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by