主要内容

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

compiler.build.ExcelClientForProductionServerOptions

构建 Excel 加载项的选项

自 R2021b 起

    说明

    opts = compiler.build.ExcelClientForProductionServerOptions(Results) 使用从 compiler.build.productionServerArchive 函数创建的 compiler.build.Results 对象 Results 创建 ExcelClientForProductionServerOptions 对象。使用 ExcelClientForProductionServerOptions 对象作为 compiler.build.excelClientForProductionServer 函数的输入。

    示例

    opts = compiler.build.ExcelClientForProductionServerOptions(FunctionFiles,ServerArchive) 使用 FunctionFiles 指定的 MATLAB® 函数和 ServerArchive 指定的 MATLAB Production Server™ 存档创建 ExcelClientForProductionServerOptions 对象。

    示例

    opts = compiler.build.ExcelClientForProductionServerOptions(FunctionFiles,ServerArchive,Name,Value) 使用一个或多个名称值参量指定选项来创建一个 ExcelClientForProductionServerOptions 对象。选项包括加载项名称、输出目录以及如何处理 Excel® 日期数据类型。

    示例

    示例

    全部折叠

    使用 compiler.build.productionServerArchive 函数的结果创建一个 ExcelClientForProductionServerOptions 对象。

    在 MATLAB 中,定位要部署到 MATLAB Production ServerMATLAB 函数。对于此示例,使用位于文件 magicsquare.mmatlabroot\extern\examples\compiler

    appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m');

    使用 compiler.build.productionServerArchive 函数构建 MATLAB Production Server 存档。将输出保存为 compiler.build.Results 对象 serverBuildResults

    serverBuildResults = compiler.build.productionServerArchive(appFile);

    使用 serverBuildResultscompiler.build.excelClientForProductionServer 函数创建 ExcelClientForProductionServerOptions 对象。

    opts = compiler.build.ExcelClientForProductionServerOptions(serverBuildResults)
    opts = 
    
      ExcelClientForProductionServerOptions with properties:
    
                             AddInName: 'magicsquare'
                          AddInVersion: '1.0.0.0'
                             ClassName: 'magicsquareClass'
                            DebugBuild: off
                         FunctionFiles: {'C:\Program Files\MATLAB\R2024b\extern\
                                        examples\compiler\magicsquare.m'}
               GenerateVisualBasicFile: on
                         ServerArchive: '.\magicsquareproductionServerArchive\magicsquare.ctf'
              ReplaceExcelBlankWithNaN: off
              ConvertExcelDateToString: off
               ReplaceNaNToZeroInExcel: off
        ConvertNumericOutToDateInExcel: off
                               Verbose: off
                             OutputDir: '.\magicsquareexcelClientForProductionServer'

    使用 ExcelClientForProductionServerOptions 对象作为 compiler.build.excelClientForProductionServer 函数的输入,为 MATLAB Production Server 构建 Excel 加载项。

    buildResults = compiler.build.excelClientForProductionServer(opts);

    使用 MATLAB 函数文件和 MATLAB Production Server 存档创建 ExcelClientForProductionServerOptions 对象。

    使用 compiler.build.productionServerArchive 函数构建 MATLAB Production Server 存档。对于此示例,使用位于文件 houdini.mmatlabroot\extern\examples\compiler

    appFile = fullfile(matlabroot,'extern','examples','compiler','houdini.m');
    compiler.build.productionServerArchive(appFile);

    使用 MATLAB Production Server 存档文件 houdini.ctf 创建 ExcelClientForProductionServerOptions 对象。

    opts = compiler.build.ExcelClientForProductionServerOptions(appFile,...
        'houdiniproductionServerArchive\houdini.ctf')
    opts = 
    
      ExcelClientForProductionServerOptions with properties:
    
                             AddInName: 'houdini'
                          AddInVersion: '1.0.0.0'
                             ClassName: 'houdiniClass'
                            DebugBuild: off
                         FunctionFiles: {'C:\Program Files\MATLAB\R2024b\extern\examples\compiler\houdini.m'}
               GenerateVisualBasicFile: off
                         ServerArchive: 'houdiniproductionServerArchive\houdini.ctf'
              ReplaceExcelBlankWithNaN: off
              ConvertExcelDateToString: off
               ReplaceNaNToZeroInExcel: off
        ConvertNumericOutToDateInExcel: off
                               Verbose: off
                             OutputDir: '.\houdiniexcelClientForProductionServer'

    使用 ExcelClientForProductionServerOptions 对象作为 compiler.build.excelClientForProductionServer 函数的输入,为 MATLAB Production Server 构建 Excel 加载项。

    buildResults = compiler.build.excelClientForProductionServer(opts);

    创建一个 ExcelClientForProductionServerOptions 对象并使用名称值参量对其进行自定义。

    使用 compiler.build.productionServerArchive 函数构建 MATLAB Production Server 存档。对于此示例,使用位于文件 houdini.mmatlabroot\extern\examples\compiler

    appFile = fullfile(matlabroot,'extern','examples','compiler','houdini.m');
    compiler.build.productionServerArchive(appFile);

    使用 MATLAB Production Server 存档文件 houdini.ctf 创建 ExcelClientForProductionServerOptions 对象。使用名称-值参量指定输出目录并生成 Visual Basic® 文件。

    opts = compiler.build.ExcelClientForProductionServerOptions(appFile,...
        'houdiniproductionServerArchive\houdini.ctf',...
        'OutputDir','D:\Documents\MATLAB\work\HoudiniMPSAddIn',...
        'GenerateVisualBasicFile','on')
    opts = 
    
      ExcelClientForProductionServerOptions with properties:
    
                             AddInName: 'houdini'
                          AddInVersion: '1.0.0.0'
                             ClassName: 'houdiniClass'
                            DebugBuild: off
                         FunctionFiles: {'C:\Program Files\MATLAB\R2024b\extern\examples\compiler\houdini.m'}
               GenerateVisualBasicFile: on
                         ServerArchive: 'houdiniproductionServerArchive\houdini.ctf'
              ReplaceExcelBlankWithNaN: off
              ConvertExcelDateToString: off
               ReplaceNaNToZeroInExcel: off
        ConvertNumericOutToDateInExcel: off
                               Verbose: off
                             OutputDir: 'D:\Documents\MATLAB\work\HoudiniMPSAddIn'

    您可以使用点符号修改现有 ExcelClientForProductionServerOptions 对象的属性值。例如,启用详尽输出。

    opts.Verbose = 'on'
    opts = 
    
      ExcelClientForProductionServerOptions with properties:
    
                             AddInName: 'houdini'
                          AddInVersion: '1.0.0.0'
                             ClassName: 'houdiniClass'
                            DebugBuild: off
                         FunctionFiles: {'C:\Program Files\MATLAB\R2024b\extern\examples\compiler\houdini.m'}
               GenerateVisualBasicFile: on
                         ServerArchive: 'houdiniproductionServerArchive\houdini.ctf'
              ReplaceExcelBlankWithNaN: off
              ConvertExcelDateToString: off
               ReplaceNaNToZeroInExcel: off
        ConvertNumericOutToDateInExcel: off
                               Verbose: on
                             OutputDir: 'D:\Documents\MATLAB\work\HoudiniMPSAddIn'

    使用 ExcelClientForProductionServerOptions 对象作为 compiler.build.excelClientForProductionServer 函数的输入,为 MATLAB Production Server 构建 Excel 加载项。

    buildResults = compiler.build.excelClientForProductionServer(opts);

    输入参数

    全部折叠

    实现 MATLAB 函数的文件列表,指定为字符向量、字符串标量、字符串数组或字符向量元胞数组。文件必须具有 .m 扩展名。

    示例: {'myFunction1.m','myFunction2.m'}

    数据类型: char | string | cell

    构建结果,指定为 compiler.build.Results 对象。通过保存来自 compiler.build.productionServerArchive 函数的输出来创建 Results 对象。

    部署在生产服务器上的 MATLAB Production Server 存档,指定为字符向量或字符串标量。

    示例: 'mpsArchive.ctf'

    数据类型: char | string

    名称-值参数

    全部折叠

    Name1=Value1,...,NameN=ValueN 的形式指定可选参量对组,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量之后,但对各个参量对组的顺序没有要求。

    如果使用的是 R2021a 之前的版本,请使用逗号分隔每个名称和值,并用引号将 Name 引起来。

    示例: 'Verbose','on'

    Excel 加载项的名称,指定为字符向量或字符串标量。生成的加载项的默认名称是 FunctionFiles 参量的第一个条目。名称必须以字母开头,并且只能包含字母和下划线。

    示例: 'AddInName','myAddIn'

    数据类型: char | string

    加载项版本,指定为字符向量或字符串标量。

    示例: 'AddInVersion','4.0'

    数据类型: char | string

    生成的类的名称,指定为字符向量或字符串标量。如果使用 ClassMap 输入,则无法指定此选项。类别名称必须符合 Excel 类别名称要求。

    默认值是追加有 ClassAddInName 参量。

    示例: 'ClassName','MagicSquareClass'

    数据类型: char | string

    将 Excel 日期转换为字符串的标志,指定为 'on''off',或者指定为数字或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则编译器会将 Excel 日期数据类型转换为 MATLAB 字符串。

    • 如果将此属性设置为 'off',则不会转换日期。

    示例: 'ConvertExcelDateToString','On'

    数据类型: logical

    将数值数据转换为 Excel 日期的标志,指定为 'on''off',或者指定为数值或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则编译器会将数字数据转换为 Excel 日期数据类型。

    • 如果将此属性设置为 'off',则不会转换数字数据。

    示例: 'ConvertNumericOutToDateInExcel','On'

    数据类型: logical

    启用调试符号的标志,指定为 'on''off',或者指定为数字或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则加载项将使用调试符号进行编译。

    • 如果将此属性设置为 'off',则加载项不会使用调试符号进行编译。

    示例: 'DebugSymbols','On'

    数据类型: logical

    用于生成 Visual Basic 文件 (.bas) 和 Excel 加载项文件 (.xla) 的标志,指定为 'on''off',或者指定为数值或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则该函数将生成一个 Excel 加载项 XLA 文件和一个 Visual Basic BAS 文件,其中包含加载项的 Microsoft® Excel 公式函数接口。

    • 如果将此属性设置为 'off',则该函数不会生成 Visual Basic 文件或 Excel 加载项文件。

    示例: 'GenerateVisualBasicFile','On'

    数据类型: logical

    保存构建文件的输出目录的路径,指定为字符向量或字符串标量。该路径可以是相对于当前工作目录的路径,也可以是绝对路径。

    构建文件夹的默认名称是加载项名称加上 excelAddIn

    示例: 'OutputDir','D:\Documents\MATLAB\work\mymagicexcelAddIn'

    数据类型: char | string

    将空白 Excel 元胞转换为 NaN 的标志,指定为 'on''off',或者指定为数字或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则编译器会在编译产物中将空白 Excel 元胞转换为 NaN。

    • 如果将此属性设置为 'off',则不会转换空白 Excel 元胞。

    示例: 'ReplaceExcelBlankWithNaN','On'

    数据类型: logical

    将 NaN 条目转换为零的标志,指定为 'on''off',或者指定为数字或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则编译器会将编译工件中的 NaN 条目转换为 Excel 中的零。

    • 如果将此属性设置为 'off',则不会转换 NaN 条目。

    示例: 'ReplaceNaNToZeroInExcel','On'

    数据类型: logical

    用于控制构建详细程度的标志,指定为 'on''off',或者指定为数字或逻辑值 1 (true) 或 0 (false)。值 'on' 等效于 true,而 'off' 等效于 false。因此,您可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState 类型的开/关逻辑值。

    • 如果将此属性设置为 'on',则 MATLAB 命令行窗口将显示进度信息,指示构建过程中的编译器输出。

    • 如果将此属性设置为 'off',则命令行窗口不会显示进度信息。

    示例: 'Verbose','On'

    数据类型: logical

    输出参量

    全部折叠

    Excel 加载项构建选项,作为 ExcelClientForProductionServerOptions 对象返回。

    版本历史记录

    在 R2021b 中推出