compiler.package.InstallerOptions
创建 MATLAB Compiler 包安装程序的选项
语法
说明
使用由 opts
= compiler.package.InstallerOptions(results
)compiler.build
函数生成的 compiler.build.Results
对象 opts
创建一个默认的 InstallerOptions
对象 results
。InstallerOptions
对象作为输入传递给 compiler.package.installer
函数。
使用 opts
= compiler.package.InstallerOptions(results
,Name,Value
)compiler.build.Results
对象 opts
创建一个 InstallerOptions
对象 results
,并使用一个或多个 名称-值参量指定其他选项。InstallerOptions
对象作为输入传递给 compiler.package.installer
函数。
创建一个 opts
= compiler.package.InstallerOptions('ApplicationName',appName
,Name,Value
)InstallerOptions
对象 opts
,其应用程序名称由 appName
指定,其他自定义内容由 名称-值参量指定。InstallerOptions
对象作为输入传递给 compiler.package.installer
函数。
示例
使用 compiler.build.standaloneApplication
函数的结果和以名称-值参量指定的附加选项创建 InstallerOptions
对象。
对于此示例,使用位于 magicsquare.m
中的
文件构建一个独立应用程序。matlabroot
\extern\examples\compiler
appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m'); results = compiler.build.standaloneApplication(appFile);
创建一个 InstallerOptions
对象。使用名称-值参量指定应用程序名称、作者公司、作者姓名、安装程序名称和摘要。
opts = compiler.package.InstallerOptions(results,... 'ApplicationName','MagicSquare_Generator',... 'AuthorCompany','Boston Common',... 'AuthorName','Frog',... 'InstallerName','MagicSquare_Installer',... 'Summary','Generates a magic square.')
opts = InstallerOptions with properties: RuntimeDelivery: 'web' InstallerSplash: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_splash.png' InstallerIcon: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_icon_48.png' InstallerLogo: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_logo.png' AdditionalFiles: {} AddRemoveProgramsIcon: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_icon_48.png' AuthorName: 'Frog' AuthorEmail: '' AuthorCompany: 'Boston Common' Summary: 'Generates a magic square.' Description: '' InstallationNotes: '' Shortcut: 'D:\Work\magicsquarestandaloneApplication\magicsquare.exe' Version: '1.0' InstallerName: 'MagicSquare_Installer' ApplicationName: 'MagicSquare_Generator' OutputDir: '.\MagicSquare_Generatorinstaller' DefaultInstallationDir: 'C:\Program Files\MagicSquare_Generator' Verbose: 'off'
您可以使用点符号修改现有 InstallerOptions
对象的属性值。例如,将安装程序名称设置为 MyMagicInstaller
。
opts.InstallerName = 'MyMagicInstaller'
要为独立应用程序创建安装程序,请使用 Results
和 InstallerOptions
对象作为 compiler.package.installer
函数的输入。
compiler.package.installer(results,'Options',opts);
MagicSquare_Installer
的文件夹中生成一个名为 MagicSquare_Generatorinstaller
的安装程序。您可以使用点符号修改现有 InstallerOptions
对象的属性值。例如,指定安装说明。
opts.InstallationNotes = 'Windows installer for MagicSquare'
创建一个 InstallerOptions
对象,其中包含应用程序名称以及以名称-值参量指定的附加选项。
opts = compiler.package.InstallerOptions('ApplicationName','MagicSquare_Generator',... 'AuthorCompany','Boston Common',... 'AuthorName','Frog',... 'InstallerName','MagicSquare_Installer',... 'Summary','Generates a magic square.')
opts = InstallerOptions with properties: RuntimeDelivery: 'web' InstallerSplash: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_splash.png' InstallerIcon: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_icon_48.png' InstallerLogo: 'C:\Program Files\MATLAB\R2025a\toolbox\compiler\packagingResources\default_logo.png' AdditionalFiles: {} AddRemoveProgramsIcon: '' AuthorName: 'Frog' AuthorEmail: '' AuthorCompany: 'Boston Common' Summary: 'Generates a magic square.' Description: '' InstallationNotes: '' Shortcut: '' Version: '1.0' InstallerName: 'MagicSquare_Installer' ApplicationName: 'MagicSquare_Generator' OutputDir: '.\MagicSquare_Generator' DefaultInstallationDir: 'C:\Program Files\MagicSquare_Generator' Verbose: 'off'
输入参数
构建结果,指定为 compiler.build.Results
对象。通过保存 compiler.build
函数的输出来创建 Results
对象。
已安装的应用程序的名称,指定为字符向量或字符串标量。
示例: 'MagicSquare_Generator'
数据类型: char
| string
名称-值参数
以 Name1=Value1,...,NameN=ValueN
的形式指定可选参量对组,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量之后,但对各个参量对组的顺序没有要求。
如果使用的是 R2021a 之前的版本,请使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: "Version","9.5"
指定已安装应用程序的版本。
自 R2023a 起
要与应用程序一起安装的附加文件和文件夹,指定为字符向量、字符串标量、字符串数组或字符向量元胞数组。路径可以是相对于当前工作目录的路径,也可以是绝对路径。
示例: "AdditionalFiles",["myimage.png","data.mat"]
数据类型: char
| string
| cell
自 R2023a 起
添加或删除程序图标,指定为字符向量或字符串标量。该图像用作设置中 Windows® 应用程序列表中的图标。路径可以是相对于当前工作目录的路径,也可以是绝对路径。
默认路径为:
"matlabroot
\toolbox\compiler\packagingResources\default_icon_48.png"
示例: "AddRemoveProgramsIcon","win_icon.png"
数据类型: char
| string
已安装应用程序的名称,指定为字符向量或字符串标量。
示例: "ApplicationName","MagicSquare_Generator"
数据类型: char
| string
创建应用程序的公司名称,指定为字符向量或字符串标量。
示例: "AuthorCompany","Boston Common"
数据类型: char
| string
应用程序作者的电子邮件地址,指定为字符向量或字符串标量。
示例: "AuthorEmail","frog@example.com"
数据类型: char
| string
应用程序作者的姓名,指定为字符向量或字符串标量。
示例: "AuthorName","Frog"
数据类型: char
| string
您希望安装程序安装应用程序的默认目录,指定为字符向量或字符串标量。
若未指定路径,则各个操作系统的默认路径为:
操作系统 | 默认安装目录 |
---|---|
Windows | C:\Program Files\ |
Linux® | /usr/ |
macOS | /Applications/ |
示例: "DefaultInstallationDir","C:\Users\MW_Programs\MagicSquare_Generator"
数据类型: char
| string
应用程序的详细描述,指定为字符向量或字符串标量。
示例: "Description","The MagicSquare_Generator application generates an n-by-n matrix constructed from the integers 1 through n2 with equal row and column sums."
数据类型: char
| string
有关使用应用程序的其他要求的说明,指定为字符向量或字符串标量。
示例: "InstallationNotes","This is a Linux installer."
数据类型: char
| string
用作已安装应用程序的图标的图像文件的路径,指定为字符向量或字符串标量。
默认路径为:
"matlabroot
\toolbox\compiler\packagingResources\default_icon_48.png"
示例: "InstallerIcon","D:\Documents\MATLAB\work\images\myIcon.png"
用作安装程序徽标的图像文件的路径,以字符向量或字符串标量形式指定。该徽标将调整大小为 112 像素 x 290 像素。
默认路径为:
"matlabroot
\toolbox\compiler\packagingResources\default_logo.png"
示例: "InstallerLogo","D:\Documents\MATLAB\work\images\myLogo.png"
安装程序文件的名称,指定为字符向量或字符串标量。扩展名由执行该函数的操作系统决定。
示例: "InstallerName","MagicSquare_Installer"
用作安装程序启动屏幕的图像文件的路径,以字符向量或字符串标量指定。启动画面图标大小将调整为 400 像素 x 400 像素。
默认路径为:
"matlabroot
\toolbox\compiler\packagingResources\default_splash.png"
示例: "InstallerSplash","D:\Documents\MATLAB\work\images\mySplash.png"
自 R2025a 起
要包含在安装程序中的可选 MATLAB® Runtime 依赖项,指定为以下选项之一:
"all"
- 使用此选项可将所有可选依赖项包含在安装程序中,包括图形化支持。此选项是默认行为。"none"
- 使用此选项则不会将任何可选依赖项包含在安装程序中。使用此选项可最大程度减小生成的安装程序的大小。
示例: "RuntimeDelivery","installer"
数据类型: char
| string
保存安装程序的文件夹路径,指定为字符向量或字符串标量。
若未指定路径,则各个操作系统的默认路径为:
操作系统 | 默认安装目录 |
---|---|
Windows | .\ |
Linux | ./ |
macOS | ./ |
上面列出的目录中的 .
代表当前工作目录。
示例: "OutputDir","D:\Documents\MATLAB\work\MagicSquare"
自 R2024a 起
选择生成的安装程序的文件类型。
"auto"
- 安装程序在创建安装程序时自动选择合适的包类型的选项。如果安装程序大小为 2GB 或更大,则安装程序将打包为 ZIP 文件。这是默认选项。"zip"
- 创建新安装程序时生成 ZIP 文件作为输出的选项。只有 Windows 才支持此选项。
示例: "PackageType","zip"
数据类型: char
| string
自 R2024a 起
MATLAB Runtime 交付选项,指定为下列之一:
"web"
- 安装程序在应用程序安装期间从 MathWorks® 网站下载 MATLAB Runtime 的选项。此选项是默认行为。"installer"
- 在安装程序中包含 MATLAB Runtime 的选项,以便可以在应用程序安装期间安装它,而无需连接到 MathWorks 网站。如果您认为最终用户可能无法访问互联网,请使用此选项。"none"
- 在应用程序安装期间不安装 MATLAB Runtime 的选项。如果您认为最终用户将使用其他方法安装 MATLAB Runtime,请使用此选项。 (自 R2024a 起)
注意
如果您使用 "web"
或 "installer"
选项,则会安装完整的 MATLAB Runtime。要创建可运行一个或多个特定 MATLAB Compiler™ (自 R2024b 起) 应用程序的最小 MATLAB Runtime 安装程序,请参阅 compiler.runtime.customInstaller
。
示例: "RuntimeDelivery","installer"
数据类型: char
| string
安装程序在安装时将创建快捷方式的文件或文件夹的路径,指定为字符向量或字符串标量。
示例: "Shortcut",".\mymagic.exe"
数据类型: char
| string
应用程序的摘要说明,指定为字符向量或字符串标量。
示例: "Summary","Generates a magic square."
数据类型: char
| string
已安装应用程序的版本号,指定为字符向量或字符串标量。
示例: "Version","2.0"
数据类型: char
| string
自 R2023b 起
用于控制输出详细程度的标志,指定为 "on"
或 "off"
,或者指定为数字或逻辑值 1
(true
) 或 0
(false
)。值 "on"
等效于 true
,值 "off"
等效于 false
。因此,可以将此属性的值用作逻辑值。该值存储为 matlab.lang.OnOffSwitchState
类型的 on/off 逻辑值。
如果将此属性设置为
"on"
,则 MATLAB 命令行窗口将显示进度信息,指示打包过程中的编译器输出。如果将此属性设置为
"off"
,则命令行窗口不会显示进度信息。这是默认行为。
示例: "Verbose","on"
数据类型: logical
输出参量
安装程序选项,作为 InstallerOptions
对象返回。
版本历史记录
在 R2020a 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)