MATLAB Answers

Ahmed
0

I need to create a stand alone .exe file from a MATLAB code (with GUI) to work on all windows platforms (32 & 64 bits) while i have only 64 bit windows and 64 bit MATLAB software.

Asked by Ahmed
on 29 Jan 2015
Latest activity Commented on by Walter Roberson
on 14 Mar 2016
Dear MATHWORKS Technical Support,
I've created a code and I would like to share it with my friends as a software only (not as a code). I can't install MCR on every and each PC. I need it to be portable so I can run this .exe file on any platform. Also I've compiled my code on my MATLAB 64 bit so it didn't work on 32 bit machines, so I need a way to compile the same code using the same 64bit MATLAB software on my PC.

  1 Comment

Note, that recent versions have incorporated the MCR download from MathWorks homepage in the package that you distribute. So when "installing" the package on your friends machine, it will look for the MCR and download and install it if not found.
Titus

Sign in to comment.

2 Answers

Answer by Harsheel
on 30 Jan 2015

  1. exe files created from 64-bit of MATLAB will run only on 64-bit Win.
  2. exe files created from 32-bit of MATLAB will run on 32-bit Win as well as 64-bit Win.
You need to install 32-bit version of MATLAB and recompile those files to create the 32-bit .exe file.
Note that if you don't use any MEX files (which are platform dependent) then, you can install the MATLAB Builder JA product to create .jar files. These files will be platform independent but of course your end users will have to write wrapper JAVA code to call the compiled .jar file. I'd go for the first workaround.
Disclaimer: I'm not from MathWorks Technical Support :)

  5 Comments

No. "All that java stuff" and similarly the ".NET stuff" generate wrappers that eventually will call the MCR just like the executable does. If you don't like the MCR (for whatever reasons), you will need to use MATLAB Coder to convert the MATLAB code to plain C code.
Titus
Generating C code seems to be impossible when talking about GUIs made in Matlab. The only way out seems to be to build a GUI in another language and converting the rest of your code to C to compile it independently (which the GUI then calls externally).
Please, someone tell me I'm wrong, because that would save me the trouble of learning another language to a sufficient degree to build a GUI.
MATLAB Coder will not generally generate any graphics. MATLAB Coder is limited to a subset of the C Standard Library, and that does not include any graphics at all. If it were extended to the C++ Standard Library the situation would not change, as that does not include any graphics either.
It would hypothetically be possible for Mathworks to generate to one of the graphics standards, but which one? OpenGL ? DirectX ? Carbon?

Sign in to comment.


Answer by Image Analyst
on 31 Jan 2015

Explain this requirement of yours in more detail: "I can't install MCR on every and each PC."
Bottom line: if you don't do that, then can't run on that computer, though they could use that computer as a "dumb terminal" to VNC into some other computer that you can install the MCR on.

  1 Comment

I actually don't want to install anything because it requires administrative access. That's why I'm trying to have my code to be a standalone file (as a portable software)

Sign in to comment.