主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

compiler.build.Results

编译器编译结果对象

说明

compiler.build.Results 对象包含有关 compiler.build 函数的构建类型、生成的文件、支持包和构建选项的信息。

所有 Results 属性都是只读的。您可以使用点符号来查询这些属性。

使用 MATLAB® Compiler™,您可以创建独立应用程序、Excel® 加载项或 Web App 存档。

使用 MATLAB Compiler SDK™,您可以为 MATLAB Production Server™ MATLAB 创建 C/C++ 共享库、.NET 程序集、COM 组件、Java® 包、Python® 包、MATLAB Production Server 可部署存档或 Excel 加载项。

创建对象

有几种方法可以创建 compiler.build.Results 对象。

如果您有 MATLAB Compiler SDK 许可证,您还可以创建以下对象。

属性

全部展开

此属性为只读。

用于生成结果的 compiler.build 函数的构建类型,指定为字符向量:

compiler.build 函数编译类型
compiler.build.standaloneApplication'standaloneApplication'
compiler.build.standaloneWindowsApplication'standaloneWindowsApplication'
compiler.build.webAppArchive'webAppArchive'
compiler.build.productionServerArchive (MATLAB Compiler SDK)'productionServerArchive'
compiler.build.excelAddIn'excelAddIn'
compiler.build.comComponent (MATLAB Compiler SDK)'comComponent'
compiler.build.cSharedLibrary (MATLAB Compiler SDK)'cSharedLibrary'
compiler.build.cppSharedLibrary (MATLAB Compiler SDK)'cppSharedLibrary'
compiler.build.dotNETAssembly (MATLAB Compiler SDK)'dotNETAssembly'
compiler.build.javaPackage (MATLAB Compiler SDK)'javaPackage'
compiler.build.pythonPackage (MATLAB Compiler SDK)'pythonPackage'
compiler.build.excelClientForProductionServer (MATLAB Compiler SDK)'excelClientForProductionServer'

数据类型: char

此属性为只读。

用于生成结果的 compiler.build 函数的编译文件的路径,指定为字符向量元胞数组。

编译类型文件
'standaloneApplication'

2×1 元胞数组

    {'path\to\ExecutableName.exe'}    
    {'path\to\readme.txt'}
'standaloneWindowsApplication'

3×1 元胞数组

    {'path\to\ExecutableName.exe'}
    {'path\to\splash.png'}
    {'path\to\readme.txt'}
'webAppArchive'

1×1 元胞数组

    {'path\to\ArchiveName.ctf'}
'productionServerArchive'

1×1 元胞数组

    {'path\to\ArchiveName.ctf'}
'excelAddIn'

2×1 或 4×1 元胞数组

    {'path\to\AddInName_AddInVersion.dll'}
    {'path\to\AddInName.bas'}
    {'path\to\AddInName.xla'}
    {'path\to\GettingStarted.html'}

注意

仅当您启用 'GenerateVisualBasicFile' 选项时才会包含文件 AddInName.basAddInName.xla

'comComponent'

2×1 元胞数组

    {'path\to\ComponentName_ComponentVersion.dll'}
    {'path\to\GettingStarted.html'}
'cSharedLibrary'

4×1 元胞数组

    {'path\to\LibraryName.h'}
    {'path\to\LibraryName.dll'}
    {'path\to\LibraryName.lib'}
    {'path\to\GettingStarted.html'}
'cppSharedLibrary'

2×1 或 4×1 元胞数组

使用 matlab-data 接口:

    {'path\to\v2\'}    
    {'path\to\GettingStarted.html'}

使用 mwArray 接口:

    {'path\to\LibraryName.h'}
    {'path\to\LibraryName.dll'}
    {'path\to\LibraryName.lib'}
    {'path\to\GettingStarted.html'}
'dotNETAssembly'

4×1 元胞数组

    {'path\to\AssemblyName.dll'}
    {'path\to\AssemblyNameNative.dll'}
    {'path\to\AssemblyName_overview.html'}
    {'path\to\GettingStarted.html'}
'javaPackage'

3×1 元胞数组

    {'path\to\PackageName.jar'}
    {'path\to\doc\'}
    {'path\to\GettingStarted.html'}
'pythonPackage'

3×1 元胞数组

    {'path\to\example\'}
    {'path\to\setup.py'}
    {'path\to\GettingStarted.html'}
'excelClientForProductionServer'

1×1 或 3×1 元胞数组

    {'path\to\AddInName.dll'}
    {'path\to\AddInName.bas'}
    {'path\to\AddInName.xla'}

注意

仅当您启用 'GenerateVisualBasicFile' 选项时才会包含文件 AddInName.basAddInName.xla

示例: {'D:\Documents\MATLAB\work\MagicSquarewebAppproductionServerArchive\MagicSquare.ctf'}

数据类型: cell

此属性为只读。

生成的组件中包含的支持包,指定为字符元胞数组元胞数组。

此属性为只读。

用于生成结果的 compiler.build 函数的构建选项,指定为相应构建类型的选项对象。

编译类型选项
'standaloneApplication'StandaloneApplicationOptions
'standaloneWindowsApplication'StandaloneApplicationOptions
'webAppArchive'WebAppArchiveOptions
'productionServerArchive'ProductionServerArchiveOptions (MATLAB Compiler SDK)
'excelAddIn'ExcelAddInOptions
'comComponent'COMComponentOptions (MATLAB Compiler SDK)
'cSharedLibrary'CSharedLibraryOptions (MATLAB Compiler SDK)
'cppSharedLibrary'CppSharedLibraryOptions (MATLAB Compiler SDK)
'dotNETAssembly'DotNETAssemblyOptions (MATLAB Compiler SDK)
'javaPackage'JavaPackageOptions (MATLAB Compiler SDK)
'pythonPackage'PythonPackageOptions (MATLAB Compiler SDK)
'excelClientForProductionServer'ExcelClientForProductionServerOptions (MATLAB Compiler SDK)

示例

全部折叠

创建一个独立的应用程序,并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.standaloneApplication('magicsquare.m')
results = 

              BuildType: 'standaloneApplication'
                  Files: {2×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.StandaloneApplicationOptions]

Files 属性包含 magicsquare 独立可执行文件和 readme.txt 文件的路径。

在 Windows 系统上创建一个独立的 Windows 应用程序,并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 Mortgage.mlapp 进行编译。

results = compiler.build.standaloneWindowsApplication('Mortgage.mlapp')
results = 

  Results with properties:

              BuildType: 'standaloneWindowsApplication'
                  Files: {3×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.StandaloneApplicationOptions]

Files 属性包含以下文件的路径:

  • Mortgage.exe

  • splash.png

  • readme.txt

创建一个 Web App 存档,并将有关构建类型、存档文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 Mortgage.mlapp 进行编译。

results = compiler.build.webAppArchive('Mortgage.mlapp')
results = 

  Results with properties:

              BuildType: 'webAppArchive'
                  Files: {'D:\Documents\MATLAB\work\MortgagewebAppArchive\Mortgage.ctf'}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.WebAppArchiveOptions]

Files 属性包含可部署存档文件 Mortgage.ctf 的路径。

创建生产服务器存档并将有关构建类型、存档文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.productionServerArchive('magicsquare.m')
results = 

  Results with properties:

                  BuildType: 'productionServerArchive'
                      Files: {'D:\Documents\MATLAB\work\magicsquareproductionServerArchive\magicsquare.ctf'}
    IncludedSupportPackages: {}
                    Options: [1×1 compiler.build.ProductionServerArchiveOptions]

Files 属性包含可部署存档文件 magicsquare.ctf 的路径。

创建一个 Excel 加载项并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.excelAddIn('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'excelAddIn'
                  Files: {2×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.ExcelAddInOptions]

Files 属性包含以下已编译文件的路径:

  • magicsquare_1_0.dll

  • GettingStarted.html

注意

仅当您在构建命令中启用 'GenerateVisualBasicFile' 选项时,文件 magicsquare.basmagicsquare.xla 才会包含在 Files 中。

在 Windows 系统上创建一个 COM 组件,并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.comComponent('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'comComponent'
                  Files: {2×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.COMComponentOptions]

Files 属性包含以下已编译文件的路径:

  • magicsquare_1_0.dll

  • GettingStarted.html

创建一个 C 库并将有关构建类型、编译文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.cSharedLibrary('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'cSharedLibrary'
                  Files: {4×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.CSharedLibraryOptions]

Files 属性包含以下文件的路径:

  • magicsquare.dll

  • magicsquare.lib

  • magicsquare.h

  • GettingStarted.html

创建一个 C++ 库并将有关构建类型、编译文件、支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.cppSharedLibrary('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'cppSharedLibrary'
                  Files: {2×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.CppSharedLibraryOptions]

Files 属性包含 v2 文件夹和 GettingStarted.html 的路径。

在 Windows 系统上创建一个 .NET 程序集,并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.dotNETAssembly('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'dotNETAssembly'
                  Files: {4×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.DotNETAssemblyOptions]

Files 属性包含以下已编译文件的路径:

  • magicsquare.dll

  • magicsquareNative.dll

  • magicsquare_overview.dll

  • GettingStarted.html

创建一个 Java 包并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.javaPackage('magicsquare.m')
results = 

  Results with properties:

              BuildType: 'javaPackage'
                  Files: {3×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.JavaPackageOptions]

Files 属性包含以下路径:

  • doc 文件夹

  • magicsquare.jar

  • GettingStarted.html

创建一个 Python 包并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 进行编译。

results = compiler.build.pythonPackage('magicsquare.m');
results = 

  Results with properties:

            BuildType: 'pythonPackage'
                Files: {3×1 cell}
IncludedSupportPackages: {}
              Options: [1×1 compiler.build.PythonPackageOptions]

Files 属性包含以下路径:

  • example 文件夹

  • setup.py

  • GettingStarted.html

MATLAB Production Server 创建一个 Excel 加载项,并将有关构建类型、生成的文件、包含的支持包和构建选项的信息保存到 compiler.build.Results 对象中。

使用文件 magicsquare.m 构建 MATLAB Production Server 存档。将输出保存为 compiler.build.Results 对象 serverBuildResults

serverBuildResults = compiler.build.productionServerArchive('magicsquare.m');

使用 serverBuildResults 对象构建 Excel 加载项。

results = compiler.build.excelClientForProductionServer(serverBuildResults)
results = 

  Results with properties:

              BuildType: 'excelClientForProductionServer'
                  Files: {1×1 cell}
IncludedSupportPackages: {}
                Options: [1×1 compiler.build.ExcelClientForProductionServerOptions]

Files 属性包含以下已编译文件的路径:

  • magicsquare.dll

  • magicsquare.bas

  • magicsquare.xla

注意

仅当您在 compiler.build.excelClientForProductionServer 命令中启用 'GenerateVisualBasicFile' 选项时,文件 magicsquare.basmagicsquare.xla 才会包含在 Files 中。

版本历史记录

在 R2020b 中推出