My program performs some simple calculations, look-ups and outputs an answer. What is efficient way to use a Matlab GUI program like I have as a standalone desktop application, which does not require Matlab as a prerequisite?
In order to run any Matlab program on a machine that doesn't have Matlab installed you will need to instal the Matlab Compiler Runtime (MCR).
This is a pre-requisite as it contains the Matlab core functionality that is required by your application and it is royalty-free.
So these are the steps you need:
In your Matlab installation, use the Matlab Compiler to generate a standalone executable of your program.
In the machine you want to deploy your application, Install the same MCR version than the Matlab version you used to generate your program.
Run the program
If you want to run a MATLAB application as stand-alone... whether it be a GUI or a script, it's not required that MATLAB be installed on your computer. You can, in fact, distribute any MATLAB application that you develop to those who don't have MATLAB installed on their computers, but you need the MATLAB Runtime libraries installed before doing so.
On the developer's end, the use of the MATLAB Compiler is required to make your MATLAB application stand-alone. You need to be cautious in that certain MATLAB functions from certain toolboxes cannot be compiled with the MATLAB Compiler if they are used as part of your MATLAB code in order to create your stand-alone application. This link from MathWorks gives a very comprehensive list of what is compatible per toolbox: http://www.mathworks.com/products/compiler/supported/compiler_support.html
On the user's end, simply get them to install the MATLAB Runtime libraries. That can be found here: http://www.mathworks.com/products/compiler/mcr/
Once the developer uses the MATLAB Compiler to create their stand-alone application and once the user installs the MATLAB Runtime libraries, then you can run any stand-alone MATLAB application. Be advised that there is no way around installing the MATLAB Runtime libraries. You need these for any MATLAB application to run stand-alone.
Related
I'm using Matlab R2016a. I'm following this video to compile my Matlab guide program as standalone application. However I can only see options to compile it for a Linux platform. Is it also possible to compile it for Windows using the Linux version of Matlab?
Sadly, at present, the answer to your question is no. In Matlab you cannot achieve cross compilation of executables. The Matlab Compiler is strictly tied to the machine environment.
The basic rule is that in order to build an executable that can run under operating system X, it must be compiler under operating system X.
Therefore, you need to install the Matlab Compiler on a Windows machine to create an executable that can run under Windows. On the top of that, Windows represents a special case in which you have to consider the difference between 32 and 64 bit versions. For more infos, read these threads:
https://it.mathworks.com/matlabcentral/answers/4649-deploy-for-windows-32-bit-from-a-64-bit-computer
https://it.mathworks.com/matlabcentral/answers/217297-32-bit-exe-compilation-using-matlab-64-installed
https://it.mathworks.com/matlabcentral/answers/60904-compile-executable-for-64-bit-system
I'm encountering a serious problem while trying to deploy a Matlab program as a stand-alone for Windows.
My end users are employees in some corporation and have only access to static computers. While they can download, unpack and execute stuff, they don't have installation privileges, so they're unable to install the Matlab Compiler Runtime (MCR). Unfortunately, they need MCR in order to run my deployed/compiled Matlab program. The deploytool offers me the option to "include MCR in the package", but it doesn't really do that. Instead, it packages the MCR installer, which is useless in my case as described above.
So how can I create a stand-alone application that runs on Windows out of the box, even without MCR installed and without installing it first? There has to be a way to compile this all the way down to binary...
You can't run Matlab code standalone without having MATLAB or the MATLAB Compiler Runtime installed. But it is legal to distribute the MCR to the customers to make them able to use your programs.
Alternatively you can use the MATLAB Coder to convert your code to C/C++, which is not completely issue-free, as just a subset of the Matlab language is supported.
Have a look at this question for the differences between MATLAB Coder and MATLAB Compiler.
Just ask IT to install the MCR, that only needs to happen once. After that the users should be able to execute your programs.
Note: There is a reason that the MCR needs to be installed, and can't just be executed. Therefore I don't expect there to be a 'trick' to avoid this.
Let say I wrote a program which has GUI. And I want to share with my friend who don't have MATLAB in his computer. Can I some how convert it to Java or other language? I tried using deploytool but it need the target computer install MCR in order to work.
Yes, you should use MATLAB Compiler (which deploytool is part of) to create a standalone executable from your GUI. The end-user does require the MCR (MATLAB Component Runtime) to run your compiled application, but you can freely distribute it if you have a license of MATLAB Compiler.
Note: last I looked, the application are OS-specific, i.e. if you use Windows to compile your application, you can only deploy in on a Windows platform.
I wrote an application (GUI) in Matlab and I want to distribute it as a console exe file, does the user need to install MCR?
Short answer: Yes
I stole a nice answer from Matlab Central:
When using the MATLAB Compiler to compile MATLAB code into a
standalone executable, you do need to install the MCR because the
generated code calls into these runtime libraries. Also, you can
package the MCR together with the executable and have it installed
automatically when the executable is run. If you are using deploytool,
you simply need to select "Add MCR" and "Embed the MCR in the package"
from the Package pane.
Note that MATLAB Coder is the other product that actually allows you
to generate truly standalone C/C++ code from MATLAB code (without any
need for additional libraries like the MCR). However, it supports only
a limited subset of the MATLAB language.
I have developed code on a m-file script in Matlab that communicates with a Measurement Computing USB-DAQ module, and I'm quite happy with that. The problem is that I don't want to purchase another license for the computer which is running the code. I have looked into Matlab Compiler Runtime tools, and it claims that I can deploy my mcc built executables to be royalty-free. Does that mean I can install the MCRInstaller (copied from the computer in which the Matlab is installed) on the host computer running the final product?
Yes. You install the Matlab Compiler Runtime (MCR) on the host computer that will be running the executable produced by the Matlab compiler.
Yes, you can install MCR and using the Deployment Tool it's easy to create a software package with all the files you need inside.