Main Content

MCC.

编译MATLAB部署函数

Description

一般用法

MCC.optionsmfilename1 mfilename2 ... mfilenamen编译选项指定的函数。

使用的选项取决于编译的预期结果。有关编译的信息:

  • C / C ++共享库,.NET程序集,Java®包裹,或python®packages seeMCC.(MATLAB Compiler SDK)对于MATLAB®编译器SDK™

  • MATLAB生产服务器™deployable archives or Excel®加载项MATLAB生产服务器看到MCC.(MATLAB Compiler SDK)对于Matlab Compiler SDK.

独立应用

MCC.-M.optionsmfilename.将函数编译成独立应用程序。

这相当于MCC -W Main -T链接:EXE

MCC.-e.optionsmfilename.将函数编译成未打开Windows的独立应用程序®命令提示执行执行。该-e.选项仅适用于Windows操作系统。

此语法相当于-W.WinMain -T link:exe

Excel加载项

MCC.-W.'excel:addin_nameclassName那version=Version_number.' -T link:liboptionsmfilename1 mfilename2 ... mfilenamencreates a微软®excel.add-in from the specified files.

  • addin_name——指定外接程序的名称及其namespace, which is a period-separated list, such ascompanyname.groupname.component.

  • className- 指定要创建的类的名称。如果未指定类名,MCC.用来addin_name作为默认值。如果指定,className,需要与之不同mfilename.

  • Version_number.-Specifies the version number of the add-in file asmajorminor.bug.build.在文件系统中。您不需要指定版本号。如果您未指定版本号,MCC.默认设置版本号,默认情况下1.0.0.0.

    • major- 指定主要版本号。如果您没有指定数字,MCC.major0.

    • 次要- 指定次版本号。如果您没有指定数字,MCC.次要0.

    • 臭虫-Specifies the bug fix maintenance release number. If you do not specify a number,MCC.臭虫0.

    • build- 指定构建号码。如果您没有指定数字,MCC.build0.

    注意

    Excel加载项只能在Windows上运行的MATLAB中创建。

    注意

    删除周围的单引号'excel:addin_name,className,version'when executing theMCC.来自DOS提示符的命令。

MapReduce应用程序Hadoop.

MCC -H -W Hadoop:archivename.,配置:configfile.generates a deployable archive that can be run as a job by Hadoop®

小费

你可以发出MCC.命令在matlab命令提示符或Windows或Linux中®system command-line.

金宝app模拟(需要金宝app编译器

MCC.-M.optionsmfilename.编译包含simulink的matlab应用程序金宝app®模拟到独立应用程序。有关更多信息,请参阅使用Simulink编译器创建和部署脚本金宝app(Simulink Compiler)

Examples

创建一个独立的应用程序

MCC.-M.魔术魔法

创建一个无法打开命令shell的独立应用程序(视窗上ly)

MCC.-e.魔术魔法

使用系统级文件版本号创建独立应用程序(视窗上ly)

创建一个独立的应用程序in Windows with version number3.4.1.5

MCC.-W.'main:mymagic,version=3.4.1.5'-T.链接:exe.mymagic.m ..

创建一个excel.add-in

MCC.-W.'Excel:Myaddin,MyClass,1.0'-T.链接:lib魔术魔法

创建一个excel.添加系统级文件版本号(视窗上ly)

使用版本号在Windows中创建Excel加载项5.2.1.7

MCC.-W.'Excel:Myaddin,MyClass,Version = 5.2.1.7'-T.链接:lib-B.班级{myclass:mymagic.m}

Create a COM component

Create a COM component in Windows with version number7.10.1.3

MCC.-W.'com:myCOMComponent,myClass,version=7.10.1.3'-T.链接:lib班级{myclass:mymagic.m}

创建一个excel.加载项MATLAB生产服务器

MCC.-W.'mpsxl:myDeployableArchvie,myExcelClass,version=1.0'-T.链接:libmymagic.m ..

为a创建独立应用程序金宝appSimulation (Requires金宝app编译器

要为Simulink仿真创建独立应用程序:金宝app

使用Simulin金宝appk创建Simulink模型。此示例使用模型sldemo_suspn_3dof.那艘船与simulink。金宝app

Create a MATLAB application that uses APIs from金宝appSimulink Compiler™模拟模型。有关更多信息,请参阅使用可调谐参数部署模拟(Simulink Compiler)

功能deployparametertuning(outputfile,mbvariable)如果ischar(mbVariable) || isstring(mbVariable) mbVariable = str2double(mbVariable);结束如果isnan(mbVariable) || ~isa(mbVariable,'双')||〜Isscalar(MBVariable)Disp('MB必须是双标量或可以转换为双标量的字符串或字符串');结束在= si金宝appmulink.simulationInput('sldemo_suspn_3dof');在= in.setvariable('Mb',mbvariable);在= si金宝appmulink.compiler.configurefordeplopment(in);Out = SIM(IN);保存(outputfile,out);结束

采用MCC.从MATLAB应用程序创建独立应用程序。

MCC.-M.deployparametertuning.m

输入参数

全部收缩

要编译的文件,指定为字符向量或字符串标量。

要编译的一个或多个文件,指定为空格分隔的文件名列表。

选项s for customizing the output, specified as a list of character vectors or string scalars.

  • -一种

    将文件添加到可部署的存档使用-一条路径要指定要添加的文件。多-一种允许的选项。

    如果a file name is specified with-一种,编译器在MATLAB路径上查找这些文件,因此指定完整路径名是可选的。这些文件未通过MBUILD.,因此您可以包含数据文件等文件。

    如果使用该文件夹名称-一种选项,这是entire contents of that folder are added recursively to the deployable archive. For example,

    mcc -m hello.m -a ./testdir

    指定所有文件Testdir.以及其子文件夹中的所有文件都将添加到可部署的存档中。文件夹子树Testdir.保留在可部署的存档中。

    如果文件名包括通配符模式,则仅添加与模式匹配的文件夹中的文件添加到可在可部署的存档中,并且不递归地处理给定路径的子文件夹。例如,

    mcc -m hello.m -a ./testdir/*

    指定所有文件./testdir.are added to the deployable archive and subfolders under./testdir.没有递归地处理。

    mcc -m hello.m -a ./testdir/*.m

    指定具有扩展名的所有文件.m./testdir.are added to the deployable archive and subfolders of./testdir.没有递归地处理。

    注意

    *is the only supported wildcard.

    将文件添加到存档时使用-一种that do not appear on the MATLAB path at the time of compilation, a path entry is added to the application's run-time path so that they appear on the path when the deployed code executes.

    当你使用的时候-一种选项要指定资源的完整路径,则保留基本路径,具有一些修改,而是相对于运行时缓存目录的子目录,而不是用户本地文件夹。第一次执行应用程序,从可部署的存档创建缓存目录。你可以使用是isdeployed.(MATLAB Compiler SDK)函数来确定应用程序是否正在部署模式下运行,并相应地调整路径。该-一种选项也创造了一个.Auth.授权目的文件。

    Caution

    如果你使用-一种flag to include a file that is not on the MATLAB path, the folder containing the file is added to the MATLAB dependency analysis path. As a result, other files from that folder might be included in the compiled application.

    注意

    如果你使用-一种标志要包含自定义Java类,独立应用程序工作无需更改classpathas long as the Java class is not a member of a package. The same applies for JAR files. However, if the class being added is a member of a package, the MATLAB code needs to make an appropriate call tojavaaddpath.至update theclasspath使用包的父文件夹。

  • -B.

    生成一个Visual Basic®文件(.bas.)containing the微软Excel.公式函数接口到COM对象生成的MATLAB Compiler。When imported into the workbook Visual Basic code, this code allows the MATLAB function to be seen as a cell formula function.

  • -B.

    Replace the file on theMCC.命令行与指定文件的内容。采用

    -b filename [:,...,]

    捆绑文档名称should contain onlyMCC.命令行选项和相应的参数和/或其他文件名。该文件可能包含其他-B.选项。一种bundle can include replacement parameters for compiler options that accept names and version numbers. See使用捆绑包构建MATLAB代码(MATLAB Compiler SDK)

  • -C

    When used in conjunction with the-L.option, suppresses compiling and linking of the generated C wrapper code. The-C选项不能独立使用-L.option.

  • -C

    不要在二进制文件中嵌入可部署的存档。

    注意

    -Cjava库忽略了标志。

  • -D.

    Place output in a specified folder. Use

    -D.外档

    指导生成的文件外档

  • -F

    Override the default options file with the specified options file. It specifically applies to the C/C++ shared libraries, COM, and Excel targets. Use

    -f filename.

    至specify文档名称作为选项文件调用时MBUILD.。此选项允许您对编译器的不同调用使用不同的ANSI编译器。此选项是直接通行证MBUILD.

  • -G-G

    Include debugging symbol information for the C/C++ code generated byMatlab Compiler SDK.。它也会产生MBUILD.将适当的调试标志传递给系统C / C ++编译器。Debug选项允许您回溯到最终可以识别故障在初始化中是否发生的点MATLAB Runtime,函数调用或终止例程。此选项不会让您使用C / C ++调试器调试Matlab文件。

  • -一世

    将新的文件夹路径添加到包含的文件夹列表中。每-一世选项将文件夹附加到要搜索的路径列表的末尾。例如,

    -一世 -I 

    设置搜索路径,以便目录1is searched first for MATLAB files, followed bydirectory2.。此选项对于独立编译非常重要,Matlab Path不可用。

    如果与之结合使用-N选项,这是-一世option adds the folder to the compilation path in the same position where it appeared in the MATLAB path rather than at the head of the path.

  • k

    直接MCC.如果由于错误而过早地结束,则不会删除输出文件。

    该default behavior ofMCC.如果命令未能成功执行,则要处理任何部分输出。

  • -M.

    直接MCC.至generate a standalone application.

  • -M.

    定义编译时选项。采用

    -m字符串

    通过直接到MBUILD.。此选项提供了一个有用的机制,用于定义编译时选项,例如,-m“-dmacro =值”

    注意

    -M.选项不会累积;只有最右边的-M.使用选项。

  • -N

    -N选项自动识别数字命令行输入并将其视为Matlab双打。

  • -N

    通过-Nclears the path of all folders except the following core folders (this list is subject to change over time):

    • matlabroot.\工具箱\ matlab.

    • matlabroot.\工具箱\local

    • matlabroot.\ toolbox \编译器

    • matlabroot.\工具箱\shared\bigdata

    通过-N还保留在编译时在Matlab路径上显示的此列表中的所有子文件夹。包含-N在命令行上,允许您从原始路径中替换文件夹,同时保留包含的文件夹的相对排序。还包括出现在原始路径上的包含包含文件夹的所有子文件夹。除此之外-N选项保留您在路径上包含的所有文件夹matlabroot.\工具箱

    使用时-N选项,使用-一世选项以强制包含一个文件夹,该文件夹放置在编译路径的头部。使用-P.有条件地包括文件夹及其子文件夹的选项;如果它们存在于MATLAB路径中,则它们以相同的顺序显示在编译路径中。

  • -O

    指定最终可执行文件的名称(仅限独立应用程序)。采用

    -o outputfile.

    命名最终的可执行输出MATLAB Compiler。一种suitable platform-dependent extension is added to the specified name (for example,。exe适用于Windows独立应用程序)。

  • -P.

    采用in conjunction with the option-N添加特定文件夹和子文件夹matlabroot.\工具箱编译matlab路径。这些文件以与MATLAB路径中显示的相同顺序添加。使用语法

    -N -P.目录

    哪里目录是要包含的文件夹。如果目录不是绝对路径,假设在当前工作文件夹下。

    • 如果包含文件夹-P.这位于原始MATLAB路径上,文件夹和原始路径上显示的所有子文件夹以相同的顺序添加到编译路径。

    • 如果包含文件夹-P.这不在原始MATLAB路径上,该文件夹被忽略。(您可以使用-一世迫使其包含。)

  • -R.

    嵌入二进制文件中的资源图标。

  • -R.

    提供MATLAB Runtime选项。此选项仅在使用Matlab编译器构建独立应用程序时才相关。语法如下:

    -R.option

    选项

    Description

    目标

    -L.ogfile,文档名称

    Specify a log file name.

    MATLAB Compiler

    -Nodisplay.

    抑制matlab.nodisplay.run-time warning.

    MATLAB Compiler

    -nojvm.

    Do not use the Java Virtual Machine (JVM).

    MATLAB Compiler

    -startmsg.

    Customizable user message displayed at initialization time.

    MATLAB Compiler独立应用s

    -Completemsg

    Customizable user message displayed when initialization is complete.

    MATLAB Compiler独立应用s

    Caution

    When running onMac OS X.那如果you use-Nodisplay.作为包含在内的选项之一mclInitializeApplication, 然后the call tomclInitializeApplicationmust occur before calling麦克伦曼

    注意

    如果您指定了-R.从Matlab Compiler SDK创建的库的选项,MCC.仍然没有错误编译并生成结果。但是-R.选项不适用于这些库,并且不做任何事情。

  • -

    标准行为MATLAB Runtime是班级的每个实例都有自己的MATLAB Runtime背景。该上下文包括用于变量的全局MATLAB工作空间,例如类中每个函数的路径和基本工作空间。如果创建了多个类的实例,则每个实例都会获得一个独立的上下文。这可确保在类的一个实例中对全局或基础工作空间所做的更改不会影响同一类的其他实例。

    在单身人士MATLAB Runtime一个类的所有实例共享的上下文。如果multiple instances of a class are created, they use the context created by the first instance which saves startup time and some resources. However, any changes made to the global workspace or the base workspace by one instance impacts all class instances. For example, ifinstance1创建一个全局变量一种在单身人士MATLAB Runtime, 然后instance2可以使用变量一种

    单身MATLAB Runtimeis only supported by the following products on these specific targets:

    单身支持的目标金宝appMATLAB Runtime Create a SingletonMATLAB Runtime通过....
    excel.add-in 目标的默认行为是单例MATLAB Runtime。您无需执行其他步骤。
    。NET assembly 目标的默认行为是单例MATLAB Runtime。您无需执行其他步骤。
    COM组件
    • 使用库编译器应用程序,单击设置并添加-到了一种dditional parameters passed to MCC领域。

    • 使用MCC.,通过-flag.

    Java package
  • -T.

    指定输出目标阶段和类型。

    使用语法-T.target至define the output type.

    目标 Description
    编译:exe. 生成C / C ++包装文件,并将C / C ++文件编译为适合链接到独立应用程序的对象表单。
    编译:lib 生成C / C ++包装文件,并将C / C ++文件编译为适合链接到共享库或DLL的对象表单。
    链接:exe. 和...一样编译:exe.并将对象文件链接到独立应用程序中。
    链接:lib 和...一样编译:lib并将对象文件链接到共享库或DLL中。

  • -U

    Register COM component for the current user only on the development machine. The argument applies only to the generic COM component and微软Excel.add-in targets.

  • -U

    构建可部署的存档(。ctf文件)for.MATLAB生产服务器

  • -v.

    显示编译步骤,包括:

    • MATLAB Compiler版本号

    • 处理后的源文件名

    • 该names of the generated output files as they are created

    • 该invocation ofMBUILD.

    -v.选项通过了-v.option toMBUILD.并显示有关的信息MBUILD.

  • -W.

    显示警告消息。使用语法

    -W.option [:]

    控制警告的显示。

    句法

    Description

    -W列表

    列出具有缩写标识符的编译时警告以及其状态。

    -w启用

    启用所有编译时警告。

    -W.禁用[:]

    禁用与之相关的特定编译时间警告。省略可选申请禁用action to all compile-time warnings.

    -w启用[:]

    启用与之相关的特定编译时警告。省略可选申请enableaction to all compile-time warnings.

    -W.error[:]

    Treat specific compile-time warnings associated with作为错误。省略可选申请erroraction to all compile-time warnings.

    -w关闭[:]

    关闭警告,针对由此定义的特定错误消息。省略可选申请关闭对所有运行时的行动。

    -w [:]

    打开与之相关的运行时警告。省略可选申请对所有运行时的行动。

    您还可以在Matlab代码中打开或关闭警告。

    例如,至turn off warnings for deployed applications (specified using是isdeployed.)在初创物, 你写:

    如果是isdeployed.warning off end

    要打开部署应用程序的警告,请写:

    如果是ISDEPELED警告结束

    您还可以指定多个-W.选项。

    例如,如果you want to disable all warnings except重复_file., 你写:

    -W.禁用-w启用:repeated_file
    指定多个时-W.选项,它们从左到右处理。

  • -W.

    控制功能包装的生成。使用语法

    -W.type

    控制函数包装的生成,用于编译器生成的MATLAB文件集合。您提供了一个函数列表,编译器生成包装器函数和任何适当的全局变量定义。

  • -X

    采用-X在依赖性分析期间忽略公共MATLAB文件I / O功能读取的数据文件。对于MATLAB文件I / O函数的列表,当您使用时忽略其数据文件-X选项,参见一种pp Packaging Dependency Analysis。有关如何使用的详细信息-X选项,参见%#排除

  • - 我

    采用

    -y license.lic.

    覆盖具有指定参数的默认许可文件。

    注意

    - 我标志仅适用于命令行模式。

    >>!MCC -M Foo.m -y License.lic

小费s

  • 在Windows上,您可以通过附加为目标文件生成系统级文件版本号version=Version_number.到目标生成MCC.句法。例如,看到使用系统级文件版本号(仅限Windows)创建独立应用程序

    Version_number.-Specifies the version of the target file asmajorminor.bug.build.在文件系统中。您不需要指定版本号。如果您未指定版本号,MCC.默认设置版本号,默认情况下1.0.0.0.

    • major- 指定主要版本号。如果您未指定版本号,MCC.major1

    • 次要- 指定次版本号。如果您未指定版本号,MCC.次要0.

    • 臭虫-Specifies the bug fix maintenance release number. If you do not specify a version number,MCC.臭虫0.

    • build- 指定构建号码。如果您未指定版本号,MCC.build0.

    独立应用程序支持此功能和Excel加载项金宝appMATLAB Compiler。对于支持金宝app的目标Matlab Compiler SDK.,看看小费s部分MCC.(MATLAB Compiler SDK)

在R2006A之前介绍