Create and Install a Deployable Archive withExcelIntegration forMATLABProduction 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 onMATLAB Production Server™.
Prerequisites
MATLAB Compiler SDK™requires .NET framework 4.0 or later to build Excel add-ins forMATLAB Production Server.
To generate the Excel add-in file (.xla), enableTrust access to the VBA project object modelin Excel. If you do not do this, you can manually create the add-in by importing the.bas
file into Excel.
Create Function inMATLAB
In MATLAB, examine the MATLAB program that you want to package.
For this example, write a functionmymagic.m
as follows.
functiony = mymagic(x) y = magic(x);
At the MATLAB command prompt, entermymagic(3)
.
The output is:
ans = 8 1 6 3 5 7 4 9 2
Create Deployable Archive withExcelIntegration 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, seeCreate Deployable Archive with Excel Integration Using compiler.build.excelClientForProductionServer.
To open theProduction Server Compilerapp, type
productionServerCompiler
at the MATLAB prompt.Alternatively, on theMATLAB Apps选项卡,最右边的Appssection, click the arrow. InApplication Deployment, clickProduction Server Compiler. In theProduction Server Compilerproject window, clickDeployable Archive with Excel integration.
In theProduction Server Compilerproject window, specify the main file of the MATLAB application that you want to deploy.
In theExported Functionssection, click
.
In theAdd Fileswindow, browse to the example folder, and select the function you want to package.
ClickOpen.
Doing so adds the function
mymagic.m
to the list of main files.
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 theMATLAB Production Serverclient. Select theDefault 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. SeeManage Required Files in Compiler Project.
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
Options— The optionRegister the resulting component for you only on the development machineexclusively registers the packaged component for one user on the development machine.
Package the Application
To generate the packaged application, clickPackage.
In the Save Project dialog box, specify the location to save the project.
In thePackagedialog box, verify thatOpen output folder when process completesis selected.
当部署过程完成, examine the generated output.
for_redistribution
— Folder containing the installer to distribute the archive on theMATLAB Production Serverclient and serverfor_redistribution_files_only
— Folder containing the files required for redistributing the application on theMATLAB Production Serverclient and serverfor_testing
— Folder containing the raw generated files to create the installerPackagingLog.html
— Log file generated byMATLAB Compiler SDK
Create Deployable Archive withExcelIntegration Usingcompiler.build.excelClientForProductionServer
As an alternative to theProduction Server Compilerapp, you can create a deployable archive with Excel integration using a programmatic approach.
Create a production server archive using
mymagic.m
and save the build results to acompiler.build.Results
object.buildResults = compiler.build.productionServerArchive('mymagic.m');
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, seecompiler.build.excelClientForProductionServer
.The
compiler.build.Results
objectbuildResults
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, seeMATLAB Compiler Limitations.readme.txt
— Text file that contains packaging and deployment information.requiredMCRProducts.txt
— Text file that contains product IDs of products required byMATLAB Runtimeto run the application.
Note
The generated Excel add-in does not includeMATLAB Runtimeor an installer. To create an installer using the
buildResults
object, seecompiler.package.installer
.
Install the Deployable Archive withExcelIntegration
You must deploy the archive to aMATLAB Production Serverinstance before you can use the add-in in Excel.
To install the deployable archive on a server instance:
Locate the archive in the
for_redistribution_files_only\server\
folder if you used the Production Server Compiler, or theaddmatrixproductionServerArchive
folder if you used thecompiler.build.productionServerArchive
function.For this example, the file name is
mymagic.ctf
.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.
For more information, seeMATLAB Production Serverdocumentation.