Embedding existing executable into a compiled Matlab executable

I have a .m script which calls an executable via the eval() command. I would like to compile this into a new executable using deploytool. However, when I attempt this the new executable fails because the .exe it is trying to call is not present. Is it possible to compile everything (the .m script & the executable it calls) into a single .exe file, or am I forced to have two .exe's? Appreciate the help.

답변 (1개)

I have two ieas.
  • Specify full path of the executableRather than input relative path (for example, hoge.exe), you can specify full path. For example,
commandName = 'C:\Programs\hoge.exe -a option1 -b option2';
% Or, if the execution is located in the folder which includes a space, use double-quotation(")
%commandName = '"C:\Program Files\hoge.exe" -a option1 -b option2';
expression = '[status,cmdout] = system(commandName)';
eval(expression);
  • Include the exe file to Files installed for your end userIn MATLAB Compiler window, you can add the execution in "Files installed for your end user". In this case, you will have two execution files, one is compiled MATLAB application and the other is the exe which is called in m script, but the installer will put both execution files in the same folder.
Hope this work.

댓글 수: 1

Regarding the first idea : If the aim is to try to get hoge.exe embedded into the new MATLAB compiled executable then which path should be gave for hoge.exe? I only know that if files are embedded into the final MATLAB executable they should be accessed thanks to which() function but how this should apply to a command string through system() function?

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

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

질문:

2017년 9월 1일

댓글:

2018년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by