Question

I'm using mcc to compile my MATLAB project. The machine I'm using has many MATLAB toolboxes installed on it, but my code only requires a few (such as distcomp and images). However, whenever I run mcc, it ends up "processing" the mcc.enc files for many toolboxes, including those that my code does not need.

Here is the beginning of the output from mcc (I'm running it with -R '-nodisplay' to be compatible with the cluster I'm using).

Warning: No display specified.  You will not be able to display graphics on the screen.
Compiler version: 4.15 (R2011a)
Processing /cm/shared/apps/matlab/7.12.0/toolbox/matlab/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/distcomp/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/images/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/stats/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/shared/imageslib/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/shared/system/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/shared/spcuilib/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/control/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/shared/controllib/engine/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/shared/controllib/general/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/signal/mcc.enc
Processing /cm/shared/apps/matlab/7.12.0/toolbox/nnet/mcc.enc

I've noticed it does the same thing when running mcc on my desktop as well. Some of these mcc.enc files (especially .../signal/mcc.enc and .../nnet/mcc.enc), take more time to process than it takes the rest of mcc to execute. Is there any way to exclude processing unneeded mcc.enc files?

Was it helpful?

Solution

Using the "deplyment tool" in the MATLAB IDE, go the project settings and from the "toolboxes on path" tab, unselect all toolboxes you do not need.

screenshot

Also, there is an mcc argument -N that clears all folders from the path and only keep the core MATLAB ones.

-N Clear Path

Passing -N effectively clears the path of all folders except the following core folders (this list is subject to change over time):

  • matlabroot/toolbox/matlab
  • matlabroot/toolbox/local
  • matlabroot/toolbox/compiler/deploy

It also retains all subfolders of the above list that appear on the MATLAB path at compile time. Including -N on the command line allows you to replace folders from the original path, while retaining the relative ordering of the included folders. All subfolders of the included folders that appear on the original path are also included. In addition, the -N option retains all folders that the user has included on the path that are not under matlabroot/toolbox.

OTHER TIPS

I would recommend using the «fdep» function from the Matlab Central File Exchange:

http://www.mathworks.com/matlabcentral/fileexchange/17291-fdep--a-pedestrian-function-dependencies-finder

This function, applied to the main function of your program will tell you the toolboxes you are using and all the functions that are being used (recursively, so all the elemental functions are listed and you shouldn't miss any function). It is really useful to reduce the size and the compiling time of your final exe.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top