compiler.build.excelClientForProductionServer
Syntax
Description
Caution
This function is only supported on Windows® operating systems.
compiler.build.excelClientForProductionServer(
creates an Excel® add-in for MATLAB®
Production Server™ using the Results)compiler.build.Results object
Results created from the
compiler.build.productionServerArchive function. Before creating
Excel add-ins, install a supported compiler.
compiler.build.excelClientForProductionServer(
creates an Excel add-in using MATLAB functions specified by FunctionFiles,ServerArchive)FunctionFiles and the MATLAB
Production Server archive specified by ServerArchive.
compiler.build.excelClientForProductionServer(
creates an Excel add-in with options specified using one or more name-value arguments. Options
include the add-in name, output directory, and how to handle the Excel date data type.FunctionFiles,ServerArchive,Name,Value)
compiler.build.excelClientForProductionServer(
creates an Excel add-in with options specified using a
opts)compiler.build.ExcelClientForProductionServerOptions object
opts. You cannot specify any other options using name-value
arguments.
Examples
Create an Excel add-in for MATLAB
Production Server on a Windows system using the results from the compiler.build.productionServerArchive function.
Ensure that you have the following installed:
The Windows SDK. For details, see Windows SDK.
MinGW-w64. To install it from the MathWorks® File Exchange, see MATLAB Support for MinGW-w64 C/C++ Compiler.
Use
mbuild -setup -client mbuild_comto ensure that MATLAB is able to create Excel add-ins.
In MATLAB, locate the MATLAB function that you want to deploy as an Excel add-in. For this example, use the file magicsquare.m
located in
.matlabroot\extern\examples\compiler
copyfile(fullfile(matlabroot,'extern','examples','compiler','magicsquare.m')); appFile = which('magicsquare.m')
Build a MATLAB
Production Server archive using the
compiler.build.productionServerArchive command. Save the output
as a compiler.build.Results object serverBuildResults.
serverBuildResults = compiler.build.productionServerArchive(appFile);
Build an Excel add-in for MATLAB
Production Server archive using the
compiler.build.excelClientForProductionServer command.
excelBuildResults = compiler.build.excelClientForProductionServer(serverBuildResults);
The function generates the following files within a folder named
magicsquareexcelClientForProductionServer in your current working
directory:
includedSupportPackages.txtmagicsquare.bas(Only if you enable the'GenerateVisualBasicFile'option)magicsquare.dllmagicsquare.regmagicsquare.xla(Only if you enable the'GenerateVisualBasicFile'option)magicsquareClass.csreadme.txtrequiredMCRProducts.txt
Create an Excel add-in for MATLAB Production Server on a Windows system using MATLAB function files and a MATLAB Production Server archive.
Create a MATLAB
Production Server archive using a MATLAB function file. For this example, use the file
magicsquare.m located in
as
an input to the matlabroot\extern\examples\compilercompiler.build.productionServerArchive
function.
mpsFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m'); compiler.build.productionServerArchive(mpsFile);
The function generates the file magicsquare.ctf in the
magicsquareproductionServerArchive folder.
Build an Excel add-in for MATLAB
Production Server archive using the
compiler.build.excelClientForProductionServer command. Specify
the function file and the CTF file as inputs.
excelBuildResults = compiler.build.excelClientForProductionServer(mpsFile,'magicsquareproductionServerArchive\magicsquare.ctf');Create an Excel add-in and customize it using name-value arguments.
Create a MATLAB
Production Server archive using a MATLAB function file. For this example, use the file
magicsquare.m located in
as
an input to the matlabroot\extern\examples\compilercompiler.build.productionServerArchive
function.
mpsFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m'); compiler.build.productionServerArchive(mpsFile);
Build an Excel add-in for MATLAB
Production Server using the
compiler.build.excelClientForProductionServer command. Use
name-value arguments to specify the add-in name, generate a Microsoft®
Visual Basic® file, and enable verbose output.
compiler.build.excelClientForProductionServer(mpsFile,... 'magicsquareproductionServerArchive\magicsquare.ctf',... 'AddInName','MyMagicSquare',... 'GenerateVisualBasicFile','on',... 'Verbose','on');
The function generates the following files within a folder named
MyMagicSquareexcelClientForProductionServer in your current working
directory:
includedSupportPackages.txtMyMagicSquare.basMyMagicSquare.dllMyMagicSquare.regMyMagicSquare.xlaMyMagicSquareClass.csreadme.txtrequiredMCRProducts.txt
Create an Excel add-ins for MATLAB
Production Server on a Windows system using a compiler.build.ExcelClientForProductionServerOptions object.
Create a MATLAB
Production Server archive using a MATLAB function file. For this example, use the file
magicsquare.m located in
as
an input to the matlabroot\extern\examples\compilercompiler.build.productionServerArchive
function.
mpsFile = which('magicsquare.m');
compiler.build.productionServerArchive(mpsFile); Create an ExcelClientForProductionServerOptions object using the
file magicsquare.m located in
.
Use name-value arguments to specify a common output directory, generate a Visual Basic file, and enable verbose output.matlabroot\extern\examples\compiler
appFile = which('magicsquare.m'); opts = compiler.build.ExcelClientForProductionServerOptions(appFile, ... 'magicsquareproductionServerArchive\magicsquare.ctf', ... 'OutputDir','D:\Documents\MATLAB\work\MPSExcelAddIn', ... 'GenerateVisualBasicFile','on','Verbose','on')
opts =
ExcelClientForProductionServerOptions with properties:
AddInName: 'houdini'
AddInVersion: '1.0.0.0'
ClassName: 'houdiniClass'
DebugBuild: off
FunctionFiles: {'C:\Program Files\MATLAB\R2025b\extern\examples\compiler\houdini.m'}
GenerateVisualBasicFile: on
ServerArchive: 'magicsquareproductionServerArchive\magicsquare.ctf'
ReplaceExcelBlankWithNaN: off
ConvertExcelDateToString: off
ReplaceNaNToZeroInExcel: off
ConvertNumericOutToDateInExcel: off
Verbose: on
OutputDir: 'D:\Documents\MATLAB\work\MPSExcelAddIn'Build the add-in using the ExcelAddInOptions object.
compiler.build.excelClientForProductionServer(opts);
Create an Excel add-in for MATLAB
Production Server and save information about the build type, generated files, included support
packages, and build options to a compiler.build.Results object.
Build a MATLAB
Production Server archive using the file magicsquare.m. Save the output as a
compiler.build.Results object serverBuildResults.
serverBuildResults = compiler.build.productionServerArchive('magicsquare.m');Build the Excel add-in using the serverBuildResults object.
results = compiler.build.excelClientForProductionServer(serverBuildResults)
results =
Results with properties:
BuildType: 'excelClientForProductionServer'
Files: {1×1 cell}
IncludedSupportPackages: {}
Options: [1×1 compiler.build.ExcelClientForProductionServerOptions]
RuntimeDependencies: [1×1 compiler.runtime.Dependencies]The Files property contains the paths to the following compiled files:
magicsquare.dllmagicsquare.basmagicsquare.xla
Note
The files magicsquare.bas and magicsquare.xla
are included in Files only if you enable the
'GenerateVisualBasicFile' option in the
compiler.build.excelClientForProductionServer command.
Input Arguments
Files implementing MATLAB functions, specified as a character vector, a string scalar, a string
array, or a cell array of character vectors. File paths can be relative to the current
working directory or absolute. Files must have a .m extension.
Example: ["myfunc1.m","myfunc2.m"]
Data Types: char | string | cell
Excel add-in build options, specified as a
compiler.build.ExcelClientForProductionServerOptions object.
Build results, specified as a compiler.build.Results object. Create the Results object by
saving the output from the compiler.build.productionServerArchive
function.
MATLAB Production Server archive deployed on the Production Server, specified as a character vector or a string scalar.
Example: 'mpsArchive.ctf'
Data Types: char | string
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
Example: 'Verbose','on'
Name of the Excel add-in, specified as a character vector or string scalar. The default name
of the generated add-in is the first entry of the FunctionFiles
argument. The name must begin with a letter and contain only alphabetic characters and
underscores.
Example: 'AddInName','myAddIn'
Data Types: char | string
Add-in version, specified as a character vector or a string scalar.
Example: 'AddInVersion','4.0'
Data Types: char | string
Name of the generated class, specified as a character vector or a string scalar. You
cannot specify this option if you use a ClassMap input. Class names
must meet the Excel class name requirements.
The default value is the AddInName argument appended with
Class.
Example: 'ClassName','MagicSquareClass'
Data Types: char | string
Flag to convert Excel date to string, 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 compiler converts the Excel date datatype to MATLAB string.If you set this property to
'off', then dates are not converted.
Example: 'ConvertExcelDateToString','On'
Data Types: logical
Flag to convert numeric data to Excel date, 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 compiler converts numeric data to the Excel date datatype.If you set this property to
'off', then numeric data is not converted.
Example: 'ConvertNumericOutToDateInExcel','On'
Data Types: logical
Flag to enable debug symbols, 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 add-in is compiled with debug symbols.If you set this property to
'off', then the add-in is not compiled with debug symbols.
Example: 'DebugSymbols','On'
Data Types: logical
Flag to generate a Visual Basic file (.bas) and an Excel add-in file (.xla), 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 function generates an Excel add-in XLA file and a Visual Basic BAS file containing the Microsoft Excel Formula Function interface to the add-in.If you set this property to
'off', then the function does not generate a Visual Basic file or an Excel add-in file.
Example: 'GenerateVisualBasicFile','On'
Data Types: logical
Path to the output directory where the build files are saved, specified as a character vector or a string scalar. The path can be relative to the current working directory or absolute.
The default name of the build folder is the add-in name appended with
excelAddIn.
Example: 'OutputDir','D:\Documents\MATLAB\work\mymagicexcelAddIn'
Data Types: char | string
Flag to convert blank Excel cells to NaN, 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 compiler converts blank Excel cells to NaN in the compiled artifact.If you set this property to
'off', then blank Excel cells are not converted.
Example: 'ReplaceExcelBlankWithNaN','On'
Data Types: logical
Flag to convert NaN entries to zero, 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 compiler converts NaN entries from the compiled artifact to zero in Excel.If you set this property to
'off', then NaN entries are not converted.
Example: 'ReplaceNaNToZeroInExcel','On'
Data Types: logical
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 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
Build results, returned as a compiler.build.Results object. The Results object contains:
Build type, which is
'excelClientForProductionServer'Paths to the following files:
AddInName.dll(if you enable theAddInName.bas'GenerateVisualBasicFile'option)(if you enable theAddInName.xla'GenerateVisualBasicFile'option)
A list of included support packages
Build options, specified as an
ExcelClientForProductionServerOptionsobjectA list of required and optional dependencies, specified as a
Dependenciesobject
Limitations
This function is only supported on Windows operating systems.
You cannot use the
compiler.package.installerfunction to create an Excel client installer. To create an installer using thecompiler.build.Resultsobject, seecompiler.package.excelClientForProductionServer.
Version History
Introduced in R2021b
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)