How do I make compiled mex files take precedence over m files when using Matlab Compiler?
5 次查看(过去 30 天)
显示 更早的评论
Normally when executing Matlab code, compiled mex files take precedence over m files. So if you have an .m and a compiled mex file, the compiled mex file will be called. Therefore, when using mex files a useful pattern which helps end users is to include an .m file for each mex file, where the .m file displays a message to the user altering them that the mex file has not been compiled. This is useful because otherwise it is hard for the end user to understand the cause of the error.
However, it seems that Matlab Compiler (mcc) has the opposite precedence; i.e. when compiling a function using mcc - m, if a mex file is invoked in the function, but a corresponding .m file exists, then the compiled mex file will be ignored and the .m file will be called instead. So with the above pattern, no compiled mex files will be included and all calls to mex files will fail. In other words, the Matlab Compiler has a different precedence behaviour to the Matlab interpreter.
Is there any way to force the Matlab Compiler mcc to include the compiled mex files in preference to .m files, to match the precedence behaviour of the interpreter? (Other than manually deleting all the corresponding .m files?)
0 个评论
回答(3 个)
Sean de Wolski
2016-10-11
Are you adding the MEX files to the CTF with the -a option in mcc (or as "Other files" in the app)?
Hazem
2018-8-30
I use the app (from the Apps tab):
Application Compiler
There, you can manually add the mex-files in the box:
Files required for your application to run
if they are not already there. For me, they were automatically detected with Matlab compiler version 9.01
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!