Create a web app archive options object
creates a opts
= compiler.build.WebAppArchiveOptions(AppFile
)WebAppArchiveOptions
object using a MATLAB® app specified by AppFile
. The
WebAppArchiveOptions
object is passed as an input to the compiler.build.webAppArchive
function.
creates a opts
= compiler.build.WebAppArchiveOptions(AppFile
,Name,Value
)WebAppArchiveOptions
object with options specified as one or more
name-value pairs. Options include the archive name, additional files to include, and the
output directory.
Create a WebAppArchiveOptions
object on a
Windows® system from an existing app named example.mlapp
.
Create a web app options object using the
compiler.build.WebAppArchiveOptions
command.
opts = compiler.build.WebAppArchiveOptions('example.mlapp')
opts = WebAppArchiveOptions with properties: ArchiveName: 'example' AppFile: 'D:\Documents\MATLAB\work\example.mlapp' AdditionalFiles: {} AutoDetectDataFiles: on OutputDir: '.\examplewebAppArchive' Verbose: off
Build a web app archive by passing the WebAppArchiveOptions
object
as an input to the build function.
buildResults = compiler.build.webAppArchive(opts);
Create a WebAppArchiveOptions
object on a
Windows system from an existing app named example.mlapp
to
specify the archive name and output directory, add a function file, and automatically
include data files provided as inputs to functions such as load
.
opts = compiler.build.webAppArchive('example.mlapp',... 'ArchiveName','MyWebApp',... 'OutputDir','D:\Documents\MATLAB\work\WebApps',... 'AdditionalFiles','mysubfunction.m',... 'AutoDetectDataFiles','on')
opts = WebAppArchiveOptions with properties: ArchiveName: 'MyWebApp' AppFile: 'D:\Documents\MATLAB\work\example.mlapp' AdditionalFiles: {D:\Documents\MATLAB\work\mysubfunction.m} AutoDetectDataFiles: on OutputDir: 'D:\Documents\MATLAB\work\WebApps' Verbose: off
You can modify property values of an existing WebAppArchiveOptions
object using dot notation.
opts.Verbose = 'on'
opts = WebAppArchiveOptions with properties: ArchiveName: 'MyWebApp' AppFile: 'D:\Documents\MATLAB\work\example.mlapp' AdditionalFiles: {D:\Documents\MATLAB\work\mysubfunction.m} AutoDetectDataFiles: on OutputDir: 'D:\Documents\MATLAB\work\WebApps' Verbose: on
AppFile
— Path to main filePath to the main file, specified as a row character vector or a string scalar. The
file must be a MATLAB app with the .mlapp
extension. The path can be relative
to the current working directory or absolute.
Example: 'mywebapp.mlapp'
Data Types: char
| string
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'Verbose','on'
'AdditionalFiles'
— Additional filesAdditional files, specified as a character vector, a string scalar, a string array, or a cell array of character vectors. The listed files are included in the web app archive. File paths can be relative to the current working directory or absolute.
Example: 'AdditionalFiles',["myvars.mat","myfunc.m"]
Data Types: char
| string
| cell
'ArchiveName'
— Name of generated web app archiveAppFile
(default) | character vector | string scalarName of the generated web app archive, specified as a character vector or a string
scalar. The default value is the file name of AppFile
.
Example: 'ArchiveName','MyWebApp'
Data Types: char
| string
'AutoDetectDataFiles'
— Flag to automatically include data files'on'
(default) | on/off logical valueFlag to automatically include data files, specified as 'on'
or
'off'
, or as numeric or logical 1
(true
) or 0
(false
). A
value of 'on'
is equivalent to true
, and
'off'
is equivalent to false
. Thus, you can
use the value of this property as a logical value. The value is stored as an on/off
logical value of type matlab.lang.OnOffSwitchState
.
If you set this property to 'on'
, then data files that
are provided as inputs to certain functions (load
,
fopen
, etc) are automatically included with the web app
archive.
If you set this property to 'off'
, then data files must
be added to the web app archive using the AdditionalFiles
property.
Example: 'AutoDetectDataFiles','Off'
Data Types: logical
'OutputDir'
— Path to output directory'ArchiveName
webAppArchive'
(default) | character vector | string scalarPath to the output directory, specified as a character vector or a string scalar. The path can be relative to the current working directory or absolute.
If no path is specified, a build folder named
is created in the current working directory.
webAppArchiveArchiveName
Example: 'OutputDir','D:\Documents\MATLAB\work\mymagicwebAppArchive'
Data Types: char
| string
'Verbose'
— Flag to control build verbosity'off'
(default) | on/off logical valueFlag to control build verbosity, specified as 'on'
or
'off'
, or as numeric or logical 1
(true
) or 0
(false
). A
value of 'on'
is equivalent to true
, and
'off'
is equivalent to false
. Thus, you can
use the value of this property as a logical value. The value is stored as an on/off
logical value of type matlab.lang.OnOffSwitchState
.
If you set this property to 'on'
, then the MATLAB Command Window displays progress information indicating code
generation stages and compiler output during the build process.
If you set this property to 'off'
, then the command
window does not display progress information.
Example: 'Verbose','On'
Data Types: logical
opts
— Web app archive build optionsWebAppArchiveOptions
objectWeb app archive build options, returned as a WebAppArchiveOptions
object.