Skip to Main Content Skip to Search
Product Documentation

mcc - Invoke MATLAB Compiler

Syntax

mcc -win32 -W 'excel:component_name,class_name,major.minor'
[-b] [-T link:lib file1..[filen]]
[-d output_dir_path] 
[-u ]

mcc -B 'cexcel:component_name,class_name,major.minor'
[-d output_dir_path]
[-u ]

Description

mcc is the MATLAB command that invokes MATLAB Compiler. You can issue the mcc command either from the MATLAB command prompt (MATLAB mode) or the DOS or UNIX® command line (standalone mode).

Options

The -W option is used when running mcc with the builder.

-B

Tells the compiler to use the cexcel bundle file option to simplify command line entry. By using this alternative to the -W option, the -T or the -b options do not need to be specified.

-B String ElementsDescription
cexcel:Keyword that tells the compiler to create an Excel component using the bundle file option.
component_nameSpecifies the name of the component to be created.
class_nameSpecifies the name of the class to be created. If you do not specify the class name, mcc uses the component name as the default.
majorSpecifies the major version number (for example, 1 in 1.0). If you do not specify a version number, mcc uses the latest version built or 1.0, if there is no previous version.
minorSpecifies the minor version number (for example, 0 in 1.0). If you do not specify a version number, mcc uses the latest version built or 1.0, if there is no previous version.

[-b]

(Optional) Generates an Excel compatible formula function for each MATLAB file.

[-d output_dir_path]

(Optional) Tells the builder to create a folder and copy the output files to it. If you use mcc instead of the Deployment Tool, the project_folder\src and project_folder\distrib folders are not automatically created.

[-S -W 'my_component,my_class' foo..[bar]]

The example creates a component called my_component containing a single class named my_class with methods foo and bar.

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

[-T link:lib file1..[filen]]

(Optional) Tells the compiler to create a DLL. Specify the keyword link:lib, which links objects into a shared library (DLL).

-u

Tells the compiler to not auto-register the COM component or Microsoft Excel add-in for the current user.

This can be helpful when a user wants to ensure the component is registered for specific privileges (such as administrator, for example).

See Deployable Component Creation and Add-in and COM Component Registration in the Getting Started chapter of this User's Guide for more information.

-W

Tells the compiler to create an Excel wrapper. This option takes a string argument that specifies the following characteristics of the component.

-W String ElementsDescription
excel:Keyword that tells the compiler the type of component to create, followed by a colon. Specify excel to create an Excel component.
component_nameSpecifies the name of the component to be created.
class_nameSpecifies the name of the class to be created. If you do not specify the class name, mcc uses the component name as the default.
majorSpecifies the major version number (for example, 1 in 1.0). If you do not specify a version number, mcc uses the latest version built or 1.0, if there is no previous version.
minorSpecifies the minor version number (for example, 0 in 1.0). If you do not specify a version number, mcc uses the latest version built or 1.0, if there is no previous version.

Using -S to Initialize a Single MCR

mcc -S -W '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.

-win32 Run in 32-Bit Mode

Use this option to build a 32-bit application on a 64-bit system only when the following are both true:

Examples

Using -W to Create an Excel Component

mcc -W 'excel:mycomponent,myclass,1.0' -T link:lib 
                                        foo.m bar.m

This example shows the mcc command used to create a COM component called mycomponent containing single COM class named myclass with methods foo and bar, and a version of 1.0 (note both major and minor versions are coded). The -T option tells mcc to create a DLL.

Using -u to Not Auto-Register an Add-in to administrator

mcc -W -u 'excel:mycomponent,myclass,1.0' -T link:lib 
                                        foo.m bar.m

In this example, the add-in generated by this build command will only be registered to the current user on the development machine. This behavior is contrary to the default behavior to auto-register the add-in or COM component to administrator.

See Deployable Component Creation and Add-in and COM Component Registration in the Getting Started chapter of this user's guide for more information.

Using -b to Create a Function for Each MATLAB File

mcc -W 'excel:mycomponent,myclass,1.0' -b -T link:lib 
                                         foo.m bar.m

To generate an Excel compatible formula function for each MATLAB file, specify the -b option.

Using -B to Simplify Command Input

mcc -B 'cexcel:mycomponent,myclass,1.0' foo.m bar.m

As an alternative to using the excel keyword, use the cexcel bundle file option to simplify command line input. In the example, note how you do not need to specify the -T or the -b options when using -B.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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