1

Is it possible to compile Matlab code into a stand alone exe? meaning being able to run the program without having to have matlab or the matlab runtime environment installed on the computer?

does it help that the code has no GUI and does not use any toolboxes? also, the only interaction the person has with the code is through the command prompt

Gevo12321
  • 549
  • 1
  • 5
  • 19
  • 3
    possible duplicate of [MATLAB Compiler vs MATLAB Coder](http://stackoverflow.com/questions/18126407/matlab-compiler-vs-matlab-coder) – chappjc Nov 20 '13 at 20:01
  • 1
    You can do that. See this link: http://stackoverflow.com/questions/6966318/build-a-standalone-application-from-matlab-code – Plo_Koon Nov 20 '13 at 20:03
  • 4
    duplicate? http://stackoverflow.com/questions/1926089/how-to-create-a-executable-exe-file-from-m-file – mattnedrich Nov 20 '13 at 20:04

1 Answers1

3

You need MATLAB Coder to generate C/C++ code from your MATLAB code. Yes, it does help that you don't have any GUI. Your code also needs to be restricted to the subset of MATLAB language that is supported by code generation. As far as toolboxes are concerned, there are quite a few which are supported by code generation.

A few people have mentioned the MATLAB Compiler. This is indeed for deployment on a machine where the end user does not have MATLAB, but it does require the installation of the runtime environment (MCR or MATLAB Component Runtime), which is freely distributable if you have a license of MATLAB Compiler. This does allow you to compile GUIs, but anything that is compiled on Windows can only be deployed on Windows, Linux on Linux, etc... (unless things have changed since I last used it).

am304
  • 13,758
  • 2
  • 22
  • 40
  • is the GUI compilation effective? – Vass Jun 28 '18 at 01:48
  • 1
    As far as I know yes, because the MCR is essentially a headless MATLAB, so all the MATLAB functionality is still available to the code for your GUI. So it's just like running MATLAB without the MATLAB interface. – am304 Jun 28 '18 at 08:02