build a standalone application from Matlab code

↘锁芯ラ 提交于 2019-12-10 08:59:19

问题


I have some Matlab code and a GUI for it and I want to make a standalone app to Protect my Source Code. How can I build this standalone? Thank you for any guide.

================================================================================

I found in help:

If you do not want to distribute your proprietary application code in this format, you can use one of these more secure options instead:

• Deploy as P-code — Convert some or all of your source code files to a content-obscured form called a P-code file (from its .p file extension), and distribute your application code in this format.

• Compile into binary format — Compile your source code files using the MATLAB Compiler to produce a standalone application. Distribute the latter to end users of your application.

working with P-codes is straightforward and no problem.

Building a Standalone Executable

Another way to protect your source code is to build it into a standalone executable and distribute the executable, along with any other necessary files, to external customers. You must have the MATLAB Compiler and a supported C or C++ compiler installed to prepare files for deployment. The end user, however, does not need MATLAB.

To build a standalone application for your MATLAB application, develop and debug your application following the usual procedure for MATLAB program files. Then, generate the executable file or files following the instructions in Steps by the Programmer to Deploy to End Users in the MATLAB Compiler documentation.

  1. Create a package that contains the software needed at run time. See What Software Does a Programmer Need? for more details.

To distribute a standalone application created with MATLAB Compiler to a development machine, create a package that includes the following files.

MCRInstaller.exe (Windows)

MCRInstaller is a self-extracting executable that installs the necessary components to develop your application. This file is included with MATLAB Compiler.

application_name.exe (Windows)

Application created by MATLAB Compiler. Maci64 must include the bundle directory hierarchy.


回答1:


I think you're getting caught up on the attraction of the .exe file. If your goal is IP protection, then the .p code suffices. If your goal is to have a .exe file, then it's not simply IP protection.

Others have already stated that the documentation is simple and straightforward. Here is a very simple step-by-step example for creating a compiled example, using the Matlab compiler. Keep in mind you need to buy the compiler or at least use the trial version if you want to see how it is done.




回答2:


You don't have to deploy a standalone application to protect your code: you can generate a P-code file from your M-files, which is a way to obfuscate source code.




回答3:


Mathworks offers a toolkit ($$) in order to compile your MATLAB programs into an executable (.exe) file that can run without a MATLAB license on any computer with the Matlab Compiler Runtime (MCR).

So the flow would look like:

  1. Develop MATLAB application (set of m files)
  2. Create simple matlab script to utilize Matlab compiler (e.g. make.m)
  3. Run the make script to create MyApplication.exe
  4. Deploy MyApplication.exe and Matlab Compiler Runtime (MCR) to your users

Details can be found on the Mathworks website.



来源:https://stackoverflow.com/questions/6966318/build-a-standalone-application-from-matlab-code

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