compiler.build.WebAppArchiveOptions

Create a web app archive options object

Description

example

opts = compiler.build.WebAppArchiveOptions(AppFile) creates a WebAppArchiveOptions object using a MATLAB® app specified by AppFile. The WebAppArchiveOptions object is passed as an input to the compiler.build.webAppArchive function.

example

opts = compiler.build.WebAppArchiveOptions(AppFile,Name,Value) creates a 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.

Examples

collapse all

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

Input Arguments

collapse all

Path 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

Name-Value Pair Arguments

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.

Example: 'Verbose','on'

Additional 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

Name 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

Flag 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

Path 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 ArchiveNamewebAppArchive is created in the current working directory.

Example: 'OutputDir','D:\Documents\MATLAB\work\mymagicwebAppArchive'

Data Types: char | string

Flag 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

Output Arguments

collapse all

Web app archive build options, returned as a WebAppArchiveOptions object.

Introduced in R2020b