| MATLAB Compiler | ![]() |
User Interaction with the Compilation Path
The MATLAB Compiler uses a dependency analysis function (depfun) to determine the list of necessary files to include in the CTF package. In some cases, this process includes an excessive number of files, for example, when MATLAB OOPS classes are included in the compilation and it cannot resolve overloaded methods at compile time. The dependency analysis is an iterative process that also processes include/exclude information on each pass. Consequently, this process can lead to very large CTF archives resulting in long compilation times for relatively small applications.
The most effective way to reduce the number of files is to constrain the MATLAB path that depfun uses at compile time. The Compiler includes features that enable you to manipulate the path. Currently, there are three ways to interact with the compilation path:
addpath and rmpath in MATLAB
-I <directory> on the mcc command line
-N and -p directories on the mcc command line (new feature)
addpath and rmpath in MATLAB
If you run the Compiler from the MATLAB prompt, you can use the addpath and rmpath commands to modify the MATLAB path before doing a compilation. There are two disadvantages:
savepath is done in MATLAB.
Passing -I< directory> on the Command Line
You can use the -I option to add a directory to the head of the path used by the current compilation. This feature is useful when you are compiling files that are in directories currently not on the MATLAB path.
Passing -N and -p <directory> on the Command Line
There are now two new Compiler options that provide more detailed manipulation of the path. This new feature acts like a "filter" applied to the MATLAB path for a given compilation. The first new option is -N. Passing -N on the mcc command line effectively clears the path of all directories except the following core directories (this list is subject to change over time):
It also retains all subdirectories of the above list that appear on the MATLAB path at compile time. Including -N on the command line also allows you to replace directories from the original path, while retaining the relative ordering of the included directories. All subdirectories of the included directories that appear on the original path are also included.
Use the -p option to add a directory to the compilation path in an order-sensitive context, i.e., the same order in which they are found on your MATLAB path. The syntax is
where <directory> is the directory to be included. If <directory> is not an absolute path, it is assumed to be under the current working directory. The rules for how these directories are included are
-p that is on the original MATLAB path, the directory and all its subdirectories that appear on the original path are added to the compilation path in an order-sensitive context.
-p that is not on the original MATLAB path, that directory is not included in the compilation. (You can use -I to add it.)
-I option while this feature is active (-N has been passed) and it is already on the MATLAB path, it is added in the order-sensitive context as if it were included with -p. Otherwise, the directory is added to the head of the path, as it normally would be with -I.
| Extracting a CTF Archive without Executing the Component | Working with the MCR | ![]() |
© 1994-2005 The MathWorks, Inc.