Matlab Compiled Standalone App Very Large Size

Hi,
I recently wrote a small Matlab script which only uses a few GUI elements (made with GUIDE), file reading/saving and plotting.
When I compile it shows its size at 907mb, I'm sure that my tiny program (which just asks for a file selection, plots some data, then give the option to save the data) should probably not have a 907mb .exe
Looking around online hasn't helped much, does anybody here have any idea why it's so huge, and what I could do to fix it? As a test I made a new script which just has 'a = 1 + 2;' in it, compiling this takes up the same 907mb of space... so I'm sure I'm doing something wrong, I just don't know what.
Thanks,
Robert
EDIT: Ah, after reading a bit more I think I understand, so the MCR is ~907mb and is required for every standalone application? Time to brush up on my C++ I guess.

1 Comment

Remember though that C++ does not in itself have any graphics facilities.

Sign in to comment.

Answers (2)

You probably have the entire MATLAB Component Runtime embedded in your .exe . Doing that allows you to send the program to other people who do not already have MCR installed and they would not have to download MCR before running the program.
MATLAB is an interpreter, not a compiler. Essentially the entire MATLAB engine and libraries has to be stored in the .exe . MATLAB Compiler does not figure out which parts of the engine and library can be skipped for your particular application.
You should perhaps be considering MATLAB Coder and a third-party graphics library (coder does not handle graphics.)
You do not need to include the entire MCR in your exe. I never do. Figure out where in your mcc code or deployment project you're doing that and turn it off. You can and should ship the MCR separately because they only need to install that once, but you might ship several versions of your code.

2 Comments

So how can I do it? I use the deploytool and don't find any options of turning something off.
It doesn't look like you can have nothing bundled in, unless you use your own installer builder package. I use mcc and then use an excellent package called Centurion Setup to deploy my executable and all the various other files (documentation, templates, sample data, etc.)
It looks like the best you can do with MATLAB's deploytool is to check the "Runtime downloaded from web" radio button, and then it will add only a small 5 MB to your app.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Asked:

on 8 Jul 2016

Commented:

on 14 Nov 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!