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
Related
Can anyone tell me if it is possible to use mxnet with matlab on windows? Using the windows packaged releases from https://github.com/dmlc/mxnet/releases, there is no "matlab" directory, which I can see is present in the newer versions, which do not have windows packages.
is there a way to get the best of both worlds?
Yes, it works, even thought I doubt it has been extensively tested. Their Matlab wrapping assumes the library lies in the lib directory, which is inconsistent with their python wrapping that assumes it lies in the build directory. So you will either have to copy libraries or change paths in callmxnet.m. Also, the demo needs data that is currently fetched by a bash script -- not very Windows friendly but it runs flawlessly with MSYS2.
IMHO the Matlab demo is currently more a proof-of-concept than a real Matlab wrapper. It is nowhere near the python bindings.
The matlab directory is directly on the repo not as a release:
https://github.com/dmlc/mxnet/tree/master/matlab
Maybe you can compile it for windows using cygwin or msys2, On the documentation it say that it was tested for matlab version:
Matlab binding has been tested with the following version:
R2016b (9.1.0.441655) 64-bit (glnxa64)
Which is a linux version; I think that it should be posible to reproduce the instructions in the readme to make it work woth cygwin or msys2 with windows
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.
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 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.