How difficult is it to convert our analysis (30 functions, 7000 lines) into a standalone executable?
1 view (last 30 days)
Show older comments
We recently made a data analysis pipeline in Matlab that produces tables and figures for some biology data. We'd like to share our methods with as many users as possible. Since that includes people without a Matlab license, we're considering converting our entire package into a standalone executable using deploytool.
Given that we'd like to do this for the whole pipeline (30 functions, 7000 lines), not just a single function, how difficult is this going to be?
0 Comments
Answers (3)
Walter Roberson
on 28 Mar 2017
The first thing you need to do is look at http://www.mathworks.com/help/compiler/unsupported-functions.html and https://www.mathworks.com/products/compiler/supported/compiler_support.html
to see whether you are using any functions that are not supported for compiling. There are entire toolboxes that are not supported -- for example Symbolic Toolbox cannot be compiled.
After that I suggest reading through http://blogs.mathworks.com/loren/2008/06/19/writing-deployable-code/ and especially the sequel http://blogs.mathworks.com/loren/2008/08/11/path-management-in-deployed-applications/ as those might lead you to rewrite how you handle file paths and changing directories.
Make sure that your entry point routine does not return until the user asks to quit. If you currently create a GUI through GUIDE and just like the GUI return to the command line, then your program will probably exit just after it starts running. You need to uiwait() or waitfor() the user to quit so that your entry point routine does not return early. Returning from your entry point routine indicates the executable should exit.
Getting all the right libraries into place is a nuisance, I gather.
The "look and feel" can be a bit different for deployed executables. If you happen to be using R2015b then you will need to work around (or repair) a compiler bug about look and feel.
2 Comments
Walter Roberson
on 28 Mar 2017
Windows 8 made it slightly tricky to get the right .NET, but not so bad. Windows 10 made it a pain to get the right .NET. I am have seen people post indicating they have managed to get the libraries working.
Unfortunately I do not have a Windows development environment to test with. (Microsoft says I don't qualify for "Home" licenses because I want to use too many of their products, but that I also do not qualify for the appropriate commercial licenses because I am not a business...)
Image Analyst
on 28 Mar 2017
Yes it is tricky and probably won't work the first time. It's a long story. But the number one thing you need to be careful about is referring to external files, like data files or whatever. You need to be very very careful about using their FULL path. Don't do anything expecting to use the current folder because the current folder is not where your executable is. I don't have time to explain it now, but take a look at the attached file. One last thing, don't put any file you expect users to change, like a .mat file or something, under the Program Files folder if you're using Windows because Windows will prevent you from changing it.
See the Compiler FAQ: http://matlab.wikia.com/wiki/FAQ#MATLAB_Compiler_Toolbox for more tips and troubleshooting ideas.
3 Comments
Walter Roberson
on 28 Mar 2017
If I recall correctly, Image Analyst prefers to build his own self-unpacking archives that include necessary libraries.
Image Analyst
on 28 Mar 2017
I compile executables all the time. I've deployed more than a hundred of them within our company. So I've learned many of the quirks of the process. Once you get it working on one system, which may take a few trials, then it should work on pretty much every other system on the same OS platform.
I've been using my own installation package builder because the deployment tool of the Compiler is (or, maybe was) kind of primitive and didn't give me the flexibility I wanted, like the ability to put any file I want into certain specifically named folders, control over what the installer looked like (graphics and so on), etc. Now I haven't looked in a couple of versions or so, so maybe I'll take a look at the deploytool with R2017a to see if it's improved any since then.
Andreas Goser
on 28 Mar 2017
Looks like you are considering purchase of MATLAB Compiler. Why don't you call Sales and ask for a trial? You even can get technical help from MathWorks.
2 Comments
See Also
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!