mcc - Invoke MATLAB® Compiler™

Syntax

mcc [- W | - S] 'java:component_name,class_name,
file1[file2...fileN]
[class{class_name:file1 [,file2,...,fileN]},...]
[-d output_dir_path]

mcc - B 'bundlefile'[:arg1, arg2, ..., argN],


Description

Use the mcc command to invoke the MATLAB Compiler product either from the MATLAB® command prompt (MATLAB mode) or the DOS or UNIX® command line (standalone mode).

mcc prepares M-file(s) for deployment outside of the MATLAB environment.

Options

-W

The -W option is used when running mcc with the MATLAB® Builder™ JA product to create a class encapsulating one or more M-files.

-W String ElementsDescription
java:Keyword that tells the compiler the type of component to create, followed by a colon. Specify java: to create a Java™ component.
component_nameSpecifies the name of the component and its namespace, which is a period-separated list, such as companyname.groupname.component.
class_nameSpecifies the name of the Java class to be created. The default class_name is the last item in the list specified as component_name.

file1 [file2...fileN] are M-files to be encapsulated as methods in class_name.

[class{class_name:file1 [,file2,...,fileN]},...]Optional. Specifies additional classes that you want to include in the component. To use this option, you specify the class name, followed by a colon, and then the names of the files you want to include in the class. You can include this multiple times to specify multiple classes.
[-d output_dir_path]Optional. Tells the builder to create a directory and copy the output files to it. If you use mcc instead of the Deployment Tool, the project_directory\src and project_directory\distrib directories are not automatically created.

The -B option is used to simplify the command-line input.

-B

The -B option tells the builder to replace a specified file with the command-line information it contains.

-B String ElementsDescription
java:Keyword that tells the compiler the type of component to create, followed by a colon. Specify java: to create a Java component.
bundlefileSpecifies the name of the file containing predefined component and class information.
[:arg1, arg2, ..., argN]Files or other arguments used by the bundlefile.

Examples

Using -W with One Class

mcc -W 'java:com.mycompany.mycomponent,myclass' 
     foo.m bar.m

The example creates a Java component that has a fully qualified package name, com.mycompany.mycomponent. The component contains a single Java class, myclass, which contains methods foo and bar.

To use myclass, place the following statement in your code:

import com.mycompany.mycomponent.myclass;

Using -W with Additional Classes

mcc -W 'java:com.mycompany.mycomponent,myclass' 
    foo.m bar.m class{myclass2:foo2.m,bar2.m}

The example creates a Java component named mycomponent with two classes:

myclass has methods foo and bar.
myclass2 has methods foo2 and bar2.

Using -B to Simplify Command Input

Suppose myoptions file contains

-W 'java:mycomponent,myclass'

In this case,

mcc -B 'myoptions' foo.m bar.m 

produces the same results as

mcc -W 'java:[mycomponent,myclass]' foo.m bar.m

Using -S to Initialize a Single MCR

mcc -S 'java:mycomponent,myclass' foo.m bar.m

The example creates a Java component called mycomponent containing a single Java class named myclass with methods foo and bar. (See the first example in this table).

If and when multiple instances of myclass are instantiated in an application, only one MCR is initialized, and it is shared by all instances of myclass.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS