Main Content

Create and Install a Deployable Archive with Excel Integration for MATLAB Production Server

Supported Platform: Microsoft® Windows® only.

This example shows how to create a deployable archive with Excel® integration using a MATLAB® function. You can then deploy the generated archive on MATLAB Production Server™.

Prerequisites

MATLAB Compiler SDK™ requires .NET framework 4.0 or later to build Excel add-ins for MATLAB Production Server.

To generate the Excel add-in file (.xla), enable Trust access to the VBA project object model in Excel. If you do not do this, you can manually create the add-in by importing the .bas file into Excel.

Create Function in MATLAB

In MATLAB, examine the MATLAB program that you want to package.

For this example, write a function mymagic.m as follows.

function y = mymagic(x)

y = magic(x);

At the MATLAB command prompt, enter mymagic(3).

The output is:

 ans =
     8     1     6
     3     5     7
     4     9     2

Create Deployable Archive with Excel Integration Using Production Server Compiler App

Package the function into a deployable archive with Excel integration using the Production Server Compiler app. Alternatively, if you want to create a deployable archive from the MATLAB command window using a programmatic approach, see Create Deployable Archive with Excel Integration Using compiler.build.excelClientForProductionServer (MATLAB Compiler SDK).

  1. To open the Production Server Compiler app, type productionServerCompiler at the MATLAB prompt.

    Alternatively, on the MATLAB Apps tab, on the far right of the Apps section, click the arrow. In Application Deployment, click Production Server Compiler. In the Production Server Compiler project window, click Deployable Archive with Excel integration.

  2. In the Production Server Compiler project window, specify the main file of the MATLAB application that you want to deploy.

    1. In the Exported Functions section, click .

    2. In the Add Files window, browse to the example folder, and select the function you want to package.

      Click Open.

    Doing so adds the function mymagic.m to the list of main files.

    Screen shot of Production Server Compiler app top navigation pane.

Customize the Application and Its Appearance

Customize your deployable archive with Excel integration and add more information about the application.

  • Archive information — Editable information about the deployed archive with Excel integration.

  • Client configuration — Configure the MATLAB Production Server client. Select the Default Server URL, decide wait time-out, and maximum size of response for the client, and provide an optional self-signed certificate for https.

  • Additional files required for your archive to run — Additional files required by the generated archive to run. These files are included in the generated archive installer. See Manage Required Files in Compiler Project (MATLAB Compiler SDK).

  • Files installed with your archive — Files that are installed with your archive on the client and server. The files installed on the server include:

    • Generated deployable archive (CTF file)

    • Generated readme.txt

    The files installed on the client include:

    • mymagic.bas

    • mymagic.dll

    • mymagic.xla

    • readme.txt

    • ServerConfig.dll

    See Specify Files to Install with Application (MATLAB Compiler SDK).

  • Options — The option Register the resulting component for you only on the development machine exclusively registers the packaged component for one user on the development machine.

Archive information, client configuration, files installed with your archive sections of the Production Server Compiler app.

Package the Application

  1. To generate the packaged application, click Package.

    In the Save Project dialog box, specify the location to save the project.

    Package doialog box.

  2. In the Package dialog box, verify that Open output folder when process completes is selected.

    When the deployment process is complete, examine the generated output.

    • for_redistribution — Folder containing the installer to distribute the archive on the MATLAB Production Server client and server

    • for_redistribution_files_only — Folder containing the files required for redistributing the application on the MATLAB Production Server client and server

    • for_testing — Folder containing the raw generated files to create the installer

    • PackagingLog.html — Log file generated by MATLAB Compiler SDK

Create Deployable Archive with Excel Integration Using compiler.build.excelClientForProductionServer

As an alternative to the Production Server Compiler app, you can create a deployable archive with Excel integration using a programmatic approach.

  1. Create a production server archive using mymagic.m and save the build results to a compiler.build.Results object.

    buildResults = compiler.build.productionServerArchive('mymagic.m');
  2. Build the deployable archive with Excel integration using the compiler.build.excelClientForProductionServer function.

    mpsxlResults = compiler.build.excelClientForProductionServer(buildResults, ...
    'Verbose','on');

    You can specify additional options in the compiler.build command by using name-value arguments. For details, see compiler.build.excelClientForProductionServer (MATLAB Compiler SDK).

    The compiler.build.Results object buildResults contains information on the build type, generated files, included support packages, and build options.

    The function generates the following files within a folder named mymagicexcelClientForProductionServer in your current working directory:

    • includedSupportPackages.txt — Text file that lists all support files included in the assembly.

    • mymagic.bas — VBA module file that can be imported into a VBA project.

    • mymagic.dll — Dynamic library required by the Excel add-in.

    • mymagic.reg — Text file that contains information on unresolved symbols.

    • mymagic.xla — Excel add-in that can be installed directly in Excel.

    • mymagicClass.cs — Text file that contains information on unresolved symbols.

    • mccExcludedFiles.log — Log file that contains a list of any toolbox functions that were not included in the application. For information on non-supported functions, see MATLAB Compiler Limitations (MATLAB Compiler).

    • readme.txt — Text file that contains packaging and deployment information.

    • requiredMCRProducts.txt — Text file that contains product IDs of products required by MATLAB Runtime to run the application.

    Note

    The generated Excel add-in does not include MATLAB Runtime or an installer. To create an installer using the buildResults object, see compiler.package.installer (MATLAB Compiler SDK).

Install the Deployable Archive with Excel Integration

You must deploy the archive to a MATLAB Production Server instance before you can use the add-in in Excel.

To install the deployable archive on a server instance:

  1. Locate the archive in the for_redistribution_files_only\server\ folder if you used the Production Server Compiler, or the addmatrixproductionServerArchive folder if you used the compiler.build.productionServerArchive function.

    For this example, the file name is mymagic.ctf.

  2. Copy the archive file to the auto_deploy folder of the server instance. The server instance automatically deploys it and makes it available to interested clients.

See Also

|