Is it possible to execute compiled code both within and out of MATLAB environment?

痴心易碎 提交于 2019-11-30 09:25:08

问题


Let me explain what I am trying to do. I have an application coded in Matlab and I would like to provide it to both Matlab users and non-Matlab users. So you would say : Just compiled it and deploy an executable. Fine.

But deployed application are somehow limited in what you can do (very importantly, you can't execute other M-file) so I would like to ALSO make it possible to Matlab users to start the deployed application from Within Matlab and provide these advanced capabilities for these guys. So Is it possible?

Of course, I could provide two versions : A .exe and .m but this is not really elegant and maybe there is a nice trick to do this. Any idea?


回答1:


You can use eval in deployed applications. You can also read .m files, since they are nothing but text. So, read the file, evaluate line by line, and there you go, you have an ability to use 3d party script .m files in your compiled Matlab program.

You will not be able to use functions in this way, only scripts.

The only thing I am not sure is whether it's legal. I can't guarantee that, you will have to contact Mathworks by yourself.




回答2:


Matlab doesn't have inbuilt functionality to do this, and, detecting whether someone has Matlab installed or not varies greatly depending on operating system.



来源:https://stackoverflow.com/questions/10566991/is-it-possible-to-execute-compiled-code-both-within-and-out-of-matlab-environmen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!