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
2012-5-23
0 个投票
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
2012-5-24
0 个投票
[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 个评论
Jan
2012-5-24
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
Kaustubha Govind
2012-5-24
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')
Kaustubha Govind
2012-5-24
Andre: Could you try the debugging step I suggested?
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Compiler 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!