Matlab Compiler Excel Addin Users Guide Coll download
Matlab Compiler Excel Addin Users Guide Coll download
download
https://ebookbell.com/product/matlab-compiler-excel-addin-users-
guide-coll-36653862
https://ebookbell.com/product/matlab-compiler-documentation-6741414
https://ebookbell.com/product/matlab-compiler-sdk-
documentation-6741904
https://ebookbell.com/product/matlab-recipes-for-earth-sciences-2nd-
trauth-martin-h-55923574
https://ebookbell.com/product/matlab-recipes-for-earth-sciences-5th-
edition-martin-h-trauth-21326300
Matlab Recipes For Earth Sciences 3rd Ed 2010 Martin H Trauth Auth
https://ebookbell.com/product/matlab-recipes-for-earth-sciences-3rd-
ed-2010-martin-h-trauth-auth-2541654
https://ebookbell.com/product/matlab-essentials-a-first-course-for-
engineers-and-scientists-1st-edition-bober-34691002
Matlab And Design Recipes For Earth Sciences How To Collect Process
And Present Geoscientific Information 2013th Edition Martin Trauth
https://ebookbell.com/product/matlab-and-design-recipes-for-earth-
sciences-how-to-collect-process-and-present-geoscientific-
information-2013th-edition-martin-trauth-4144474
https://ebookbell.com/product/matlab-in-bioscience-and-biotechnology-
leonid-burstein-4146942
https://ebookbell.com/product/matlab-for-engineers-explained-1st-
edition-fredrik-gustafsson-4189370
MATLAB® Compiler™
MATLAB® Compiler™ Excel® Add-In User's Guide
R2021b
How to Contact MathWorks
Phone: 508-647-7000
Getting Started
2
How MATLAB Compiler Excel Integration Works . . . . . . . . . . . . . . . . . . . . 2-2
MATLAB Compiler Excel Add-In Limitations . . . . . . . . . . . . . . . . . . . . . . . 2-2
Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
iii
Customizing a Compiler Project
3
Customize an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Customize the Installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Determine Data Type of Command-Line Input (For Packaging Standalone
Applications Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Manage Required Files in Compiler Project . . . . . . . . . . . . . . . . . . . . . . . 3-4
Sample Driver File Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Specify Files to Install with Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Additional Runtime Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
iv Contents
MATLAB Code Deployment
5
How Does MATLAB Deploy Functions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
v
Microsoft Excel Add-In Integration
7
Integrate Components Using Visual Basic Application . . . . . . . . . . . . . . . 7-2
When to Use Formula Functions or Subroutines . . . . . . . . . . . . . . . . . . . . 7-2
Initialize MATLAB Compiler Libraries with Microsoft Excel . . . . . . . . . . . . 7-2
Create an Instance of a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Call the Methods of a Class Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Program with Variable Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
Modify Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
Handle Errors During a Method Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
Improve Data Access Using the MATLAB Runtime User Data Interface
and COM Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
vi Contents
Functions
9
vii
Property MWFlags As MWFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23
Sub Clone(ppSparse As MWSparse) . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23
Apps
11
Data Conversion
A
Data Conversion Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Troubleshooting
B
Errors and Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2
Excel Add-Ins Errors and Suggested Solutions . . . . . . . . . . . . . . . . . . . . . B-3
Required Locations to Develop and Use Components . . . . . . . . . . . . . . . . B-5
Microsoft Excel Errors and Suggested Solutions . . . . . . . . . . . . . . . . . . . B-5
Function Wizard Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-6
viii Contents
1
a
In the Exported Functions section of the toolstrip, click .
b In the Add Files window, browse to the example folder, and select the function you want to
package. Click Open.
The function is added to the list of exported function files. Repeat this step to package multiple
files in the same application.
3 In the Packaging Options section of the toolstrip, decide whether to include the MATLAB
Runtime installer in the generated application by selecting one of the options:
• Runtime downloaded from web — Generate an installer that downloads the MATLAB
Runtime and installs it along with the deployed MATLAB application. You can specify the file
name of the installer.
• Runtime included in package — Generate an application that includes the MATLAB
Runtime installer. You can specify the file name of the installer.
Note The first time you select this option, you are prompted to download the MATLAB
Runtime installer.
4 Verify that the MATLAB function you are packing into an Excel add-in is mapped onto a class. You
can change the name from the default name Class 1 to something more meaningful.
5 Customize the packaged application and its appearance:
• Library information — Editable information about the deployed application. You can also
customize the standalone applications appearance by changing the application icon and
splash screen. The generated installer uses this information to populate the installed
application metadata. See “Customize the Installer”.
• Additional installer options — Edit the default installation path for the generated installer
and selecting custom logo. See “Change the Installation Path” .
• Files required for your library to run — Additional files required by the generated
application to run. These files are included in the generated application installer. See
“Manage Required Files in Compiler Project”.
• Files installed for your end user — Files that are installed with your application.
1 Click Package.
In the Save Project dialog box, specify the location to save the project.
2 In the Package dialog box, verify that Open output folder when process completes is
selected.
1-2
Create Excel Add-In
When the packaging process is complete, examine the generated output in the target folder.
For more information about the files generated in these folders, see “Files Generated
After Packaging MATLAB Functions”.
• The log file PackagingLog.html contains packaging results.
See Also
More About
• “Create Excel Add-In from MATLAB” on page 2-8
1-3
2
Getting Started
MATLAB Compiler generates two primary artifacts from your MATLAB code: a COM component
(.dll file) and a Visual Basic® for Applications (VBA) module file (.bas file). The compiler integrates
the COM wrapper with the compiler-generated VBA code to create a Microsoft Excel add-in (.xla
file), saving you considerable development resources and time.
COM is an acronym for Component Object Model, which is a Microsoft binary standard for object
interoperability. COM components use a common integration architecture that provides a consistent
model across multiple applications. All Microsoft Office applications support COM add-ins.
Each COM object exposes a class to the Visual Basic programming environment. The class contains a
set of functions called methods. These methods correspond to the original MATLAB functions
included in the project. MATLAB Compiler generated COM components contain a single class. This
class provides the interface to the MATLAB functions that you add to the class at build time. The
COM component provides a set of methods that wrap the MATLAB code and a DLL file.
The MATLAB Compiler generates supporting files. Include these supporting files when you package
and distribute an application. Include MATLAB Runtime to access an entire library of MATLAB
functions without needing a licensed copy of MATLAB.
For information about how MATLAB Compiler works, see “How Does MATLAB Deploy Functions?” on
page 5-2.
To verify your MATLAB code or function can be deployed successfully, see “Write Deployable MATLAB
Code”.
• No outputs
• Figure (graphical) output
• Scalar output
• Multidimensional matrix output
MATLAB objects are not supported as inputs or outputs for compiled or deployed functions with
MATLAB Compiler for Excel add-ins.
Next Steps
MATLAB Compiler includes several examples in addition to the magic square example. You can find
these examples in matlabroot\toolbox\matlabxl\examples\. The following table identifies
examples by folder:
2-2
How MATLAB Compiler Excel Integration Works
For Example Files Relating Find Example Code in For Example Documentation
To... Folder... See...
Magic Square Example xlmagic “Create Excel Add-In from
MATLAB” on page 2-8
Variable-Length Argument xlmulti “Create Macros from MATLAB
Example Functions with Multiple
Arguments” on page 6-3
Calling Compiled MATLAB xlbasic “Assign Multiple MATLAB
Functions from Microsoft Excel Functions to Excel Class” on
page 8-2
Spectral Analysis Example xlspectral “Build and Integrate Spectral
Analysis Functions” on page 7-
11
The following topics detail some of the more common tasks you perform as you continue to develop
your applications.
To: See:
Try more examples using the MATLAB Compiler MATLAB Central. Set the Search field to File
Exchange and search for one or more of the
following:
• InterpExcelDemo
• MatrixMathExcelDemo
• ExcelCurveFit
Learn how to write MATLAB code that is “Write Deployable MATLAB Code”
optimized for deployment
Work with functions having graphical output “Execute Add-In and Graphical Function” on page
6-8
Work with functions having variable inputs and “Create Macros from MATLAB Functions with
output Multiple Arguments” on page 6-3
Create displayable dialog boxes and error “Create Dialog Box and Error Message Macros”
messages on page 6-10
Troubleshoot common error messages “Errors and Solutions” on page B-2
Integrate your application into your enterprise “Integrate Components Using Visual Basic
environment by enhancing your application's Application” on page 7-2
generated Visual Basic code
See Also
Related Examples
• “Distribute Add-Ins and Integrate Into Microsoft Excel” on page 2-14
• “How Does MATLAB Deploy Functions?” on page 5-2
• “Write Deployable MATLAB Code”
2-3
2 Getting Started
• MATLAB
• MATLAB Compiler
• A supported C or C++ compiler
Failure to do so may result in add-ins not being generated or warning messages sent to MATLAB
Compiler
Depending on what version of Microsoft Excel you are using, do one of the following:
1 Click File > Options > Trust Center > Trust Center Settings > Macro Settings.
2 In Developer Macro Settings, select Trust access to the VBA project object model.
• For Microsoft Excel 2007:
1 Click
Tools > Macro > Security.
2 For Security Level, select Medium.
2-4
MATLAB Compiler for Microsoft Excel Add-In Prerequisites
Applications developed on one architecture must be compatible with the architecture on the system
where they are deployed. For example, if you have a 64-bit system, you usually install a 64-bit version
of MATLAB (and most other applications) by default. Running functions you have developed with a
64-bit version of MATLAB requires a 64-bit version of Microsoft Excel.
Add-ins created with MATLAB Compiler are compatible with both 32–bit and 64–bit versions of
Microsoft Excel. MATLAB Compiler itself is in 64–bit only.
For more detailed information about dependency analysis (depfun) and how MATLAB Compiler
evaluates MATLAB code prior to compilation, see “Write Deployable MATLAB Code”.
2-5
2 Getting Started
.
Microsoft Excel developer • Some or no MATLAB • Roll out the packaged
experience. component and integrate it
• Microsoft Excel expert. into the end-user
environment.
• Proficient writing VB/VBA
code. • Write VB/VBA code to
complement or augment the
Excel add-in built by the
MATLAB programmer. Add
and modify code as needed.
• Uses Function Wizard to
customize the add-in and
create executable macros.
• Verify that the final
application executes reliably
in the end-user environment.
2-6
Choose Function Deployment Workflow
Other Examples
For other types of examples, see the following:
• InterpExcelDemo
• MatrixMathExcelDemo
• ExcelCurveFit
2-7
2 Getting Started
This example shows how to use MATLAB Compiler to generate a Microsoft Excel add-in containing a
custom function for use within Excel. The custom function mymagic returns an n-by-n matrix filled
with positive integers with equal row and column sums. The target system does not require a licensed
copy of MATLAB to run the add-in.
Prerequisites
• Verify that you have met all of the MATLAB Compiler Excel target requirements. For details, see
“MATLAB Compiler for Microsoft Excel Add-In Prerequisites” on page 2-4.
• Verify that you have Microsoft Excel installed.
• End users must have an installation of MATLAB Runtime to run the add-in. For details, see “Install
and Configure MATLAB Runtime” (MATLAB Compiler SDK).
For testing purposes, you can use an installation of MATLAB instead of MATLAB Runtime.
For this example, compile using the file mymagic.m located in matlabroot\toolbox\matlabxl
\examples\xlmagic.
function y = mymagic(x)
y = magic(x)
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
1 On the MATLAB Apps tab, on the far right of the Apps section, click the arrow. In Application
Deployment, click Library Compiler. In the MATLAB Compiler project window, click Excel
Add-in.
2-8
Create Excel Add-In from MATLAB
Alternately, you can open the Library Compiler app by entering libraryCompiler at the
MATLAB prompt.
2 In the Library Compiler app project window, specify the files of the MATLAB application that
you want to deploy.
a
In the Exported Functions section of the toolstrip, click .
b In the Add Files window, browse to the example folder, and select the function you want to
package. Click Open.
The function is added to the list of exported function files. Repeat this step to package multiple
files in the same application.
3 In the Packaging Options section of the toolstrip, decide whether to include the MATLAB
Runtime installer in the generated application by selecting one of the options:
• Runtime downloaded from web — Generate an installer that downloads the MATLAB
Runtime and installs it along with the deployed MATLAB application. You can specify the file
name of the installer.
• Runtime included in package — Generate an application that includes the MATLAB
Runtime installer. You can specify the file name of the installer.
Note The first time you select this option, you are prompted to download the MATLAB
Runtime installer.
4 Verify that the function defined in mymagic.m is mapped into Class1.
• Library information — Editable information about the deployed application. The generated
installer uses this information to populate the installed application metadata. See “Customize
the Installer”.
• Additional installer options — Edit the default installation path for the generated installer
and selecting custom logo. See “Change the Installation Path” .
• Files required for your library to run — Additional files required by the generated
application to run. These files are included in the generated application installer. See
“Manage Required Files in Compiler Project”.
2-9
2 Getting Started
• Files installed for your end user — Files that are installed with your application.
1 Click Package.
In the Save Project dialog box, specify the location to save the project.
2 In the Package dialog box, verify that Open output folder when process completes is
selected.
When the packaging process is complete, examine the generated output in the target folder.
2-10
Create Excel Add-In from MATLAB
For more information about the files generated in these folders, see “Files Generated After
Packaging MATLAB Functions”.
• The log file PackagingLog.html contains packaging results.
1 In MATLAB, locate the MATLAB code that you want to deploy as a standalone application. For
this example, compile using the file mymagic.m located in matlabroot\toolbox\matlabxl
\examples\xlmagic.
appFile = fullfile(matlabroot,'toolbox','matlabxl','examples','xlmagic','mymagic.m');
2 Build the Excel add-in using the compiler.build.excelAddIn function. Use name-value
arguments to generate the BAS and XLA files.
Note To generate the XLA file, enable Trust access to the VBA project object model in Excel.
The function generates the following files within a folder named mymagicexcelAddIn in your
current working directory:
• dlldata.c
• GettingStarted.html
• includedSupportPackages.txt
• mymagic.def
• mymagic.bas
• mymagic.rc
• mymagic.xla
• mymagic_1_0.dll
• mymagic_dll.cpp
• mymagic_idl.h
• mymagic_idl.idl
• mymagic_idl.tlb
• mymagic_idl_i.c
• mymagic_idl_p.c
• mymagicClass_com.cpp
• mymagicClass_com.hpp
• mccExcludedFiles.log
2-11
2 Getting Started
• mwcomtypes.h
• mwcomtypes_i.c
• mwcomtypes_p.c
• readme.txt
• requiredMCRProducts.txt
• unresolvedSymbols.txt
Note The generated assembly does not include MATLAB Runtime or an installer. To create an
installer using the buildResults object, see compiler.package.installer.
Specify additional options by using one or more comma-separated pairs of name-value arguments
in the compiler.build command.
For example, you can specify the add-in name and enable verbose output.
buildResults = compiler.build.excelAddIn(appFile,...
'GenerateVisualBasicFile','on', ...
'AddInName','MyMagicExcel','Verbose','On');
2-12
Create Excel Add-In from MATLAB
=mymagic(3)
As you type my in the formula bar, mymagic appears as a custom function in Excel.
3 Press Ctrl+Shift+Enter on the keyboard.
8 1 6
3 5 7
4 9 2
Distribute Add-In
To distribute your add-in to end users, see “Distribute Add-Ins and Integrate Into Microsoft Excel” on
page 2-14.
See Also
libraryCompiler | compiler.build.excelAddIn
More About
• “Execute Functions and Create Macros” on page 4-2
2-13
2 Getting Started
For general information on programming in Visual Basic, refer to the VBA documentation provided
with Excel.
If you do not create an installer, distribute the files that the Library Compiler generates in the
for_redistribution_files_only folder. For a list of files generated in each folder, see “Files
Generated After Packaging MATLAB Functions”.
If you find you need to change your run-time permissions due to security standards imposed by
Microsoft or your installation, you can do one of the following before deploying your COM component
or add-in:
2-14
Distribute Add-Ins and Integrate Into Microsoft Excel
where:
• /u allows any user to unregister a COM component or add-in for this server
• /s runs this command silently, generating no messages. This is helpful for use in silent
installations.
• /useronly allows only the currently logged-in user to run the COM component or add-in on
this server
Caution If your COM component is registered in the USER hive, it will not be visible to Windows
Vista™ or Windows 7 users running as administrator on systems with UAC (User Access
Control) enabled.
If you register a component to the USER hive under Windows 7 or Windows Vista, your COM
component may fail to load when running with elevated (administrator) privileges.
If this occurs, do the following to re-register the component to the LOCAL MACHINE hive:
mwregsvr my_dll.dll
To run the executable code from a cell in the Excel spreadsheet, invoke the add-in name with a
method call. For example, if you deployed a piece of MATLAB code called mymagic.m, or a figure
called mymagic.fig, you invoke that code by entering the following in a cell in the spreadsheet:
=mymagic()
Tip If the method call does not evaluate immediately, press Ctrl, Shift, and Enter simultaneously.
See Also
Related Examples
• “How MATLAB Compiler Excel Integration Works” on page 2-2
• “Integrate Components Using Visual Basic Application” on page 7-2
• “Reference Utility Classes” on page 10-2
• “Errors and Solutions” on page B-2
2-15
3
Customize an Application
You can customize an application in several ways: customize the installer, manage files in the project,
or add a custom installer path using the Application Compiler app or the Library Compiler app.
To change the default icon, click the graphic to the left of the Library name or Application name
field to preview the icon.
Click Select icon, and locate the graphic file to use as the application icon. Select the Use mask
option to fill any blank spaces around the icon with white or the Use border option to add a border
around the icon.
• Library/Application Name: The name of the installed MATLAB artifacts. For example, if the name
is foo, the installed executable is foo.exe, and the Windows start menu entry is foo. The folder
created for the application is InstallRoot/foo.
The default value is the name of the first function listed in the Main File(s) field of the app.
• Version: The default value is 1.0.
• Author name: Name of the developer.
• Support email address: Email address to use for contact information.
• Company name: The full installation path for the installed MATLAB artifacts. For example, if the
company name is bar, the full installation path would be InstallRoot/bar/ApplicationName.
• Summary: Brief summary describing the application.
• Description: Detailed explanation about the application.
All information is optional and, unless otherwise stated, is only displayed on the first page of the
installer. On Windows systems, this information is also displayed in the Windows Add/Remove
Programs control panel.
3-2
Customize an Application
The installer splash screen displays after the installer has started. It is displayed along with a status
bar while the installer initializes.
You can change the default image by clicking the Select custom splash screen. When the file
explorer opens, locate and select a new image.
You can drag and drop a custom image onto the default splash screen.
This table lists the default path the installer uses when installing the packaged binaries onto a target
system.
You can change the default installation path by editing the Default installation folder field under
Additional installer options.
3-3
3 Customizing a Compiler Project
A text field specifying the path appended to the root folder is your installation folder. You can pick the
root folder for the application installation folder. This table lists the optional custom root folders for
each platform:
Windows C:\Users\userName\AppData
Linux /usr/local
The logo displays after the installer has started. It is displayed on the right side of the installer.
You change the default image in Additional Installer Options by clicking Select custom logo.
When the file explorer opens, locate and select a new image. You can drag and drop a custom image
onto the default logo.
Installation notes are displayed once the installer has successfully installed the packaged files on the
target system. You can provide useful information concerning any additional setup that is required to
use the installed binaries and instructions for how to run the application.
To pass inputs to the standalone application as MATLAB character vectors, select Treat all inputs to
the app as MATLAB character vectors. In this case, you must include code to convert char to a
numeric MATLAB type in the MATLAB function to be deployed as a standalone application.
To pass inputs to the standalone application as numeric MATLAB variables, select Treat all inputs to
the app as numeric MATLAB doubles. option in the Application Compiler App. Thus, you do not
need to include code to convert char to a numeric MATLAB type. Non numeric inputs to the
application may result in an error.
3-4
Customize an Application
If you are using one of the compiler apps, the required files discovered by the dependency analysis
function are listed in the Files required for your application to run or Files required for your
library to run field.
To add files, click the plus button in the field, and select the file from the file explorer. To remove files,
select the files, and press the Delete key.
Caution Removing files from the list of required files may cause your application to not package or
not to run properly when deployed.
Using mcc
If you are using mcc to package your MATLAB code, the compiler does not display a list of required
files before running. Instead, it packages all the required files that are discovered by the dependency
analysis function and adds them to the generated binary file.
You can add files to the list by passing one or more -a arguments to mcc. The -a arguments add the
specified files to the list of files to be added into the generated binary. For example, -a hello.m
adds the file hello.m to the list of required files and -a ./foo adds all the files in foo and its
subfolders to the list of required files.
The sample driver file creation feature in Library Compiler uses MATLAB code to generate sample
driver files in the target language. The sample driver files are used to implement the generated
shared libraries into an application in the target language. In the app, click Create New Sample to
automatically generate a new MATLAB script, or click Add Existing Sample to upload a MATLAB
script that you have already written. After you package your functions, a sample driver file in the
target language is generated from your MATLAB script and is saved in
for_redistribution_files_only\samples. Sample driver files are also included in the installer
in for_redistribution.
3-5
3 Customizing a Compiler Project
To automatically generate a new MATLAB file, click Create New Sample. This opens up a MATLAB
file for you to edit. The sample file serves as a starting point, and you can edit it as necessary based
on the behavior of your exported functions. The sample MATLAB files must follow these guidelines:
To upload a MATLAB file that you have already written, click Add Existing Sample. The MATLAB
code should demonstrate how to execute the exported functions. The required MATLAB code can be
only a few lines:
input1 = [1 4 7; 2 5 8; 3 6 9];
input2 = [1 4 7; 2 5 8; 3 6 9];
addoutput = addmatrix(input1,input2);
This code must also follow all the same guidelines outlined for the Create New Sample option.
You can also choose not to include a sample driver file at all during the packaging step. If you create
your own driver code in the target language, you can later copy and paste it into the appropriate
directory once the MATLAB functions are packaged.
These files are listed in the Files installed for your end user section of the app.
To add files to the list, click , and select the file from the file explorer.
JAR files are added to the application class path as if you had called javaaddpath.
Caution Removing the binary targets from the list results in an installer that does not install the
intended functionality.
3-6
Customize an Application
When installed on a target computer, the files listed in the Files installed for your end user are
saved in the application folder.
3-7
3 Customizing a Compiler Project
See Also
applicationCompiler | libraryCompiler
More About
• “Create Standalone Application from MATLAB”
• “Create Excel Add-In from MATLAB” on page 2-8
• “Generate a C++ mwArray API Shared Library and Build a C++ Application” (MATLAB
Compiler SDK)
• “Generate a C++ MATLAB Data API Shared Library and Build a C++ Application” (MATLAB
Compiler SDK)
3-8
Manage Support Packages
The list displays all installed support packages that your MATLAB code requires. The list is
determined using these criteria:
Some support packages require third-party drivers that the compiler cannot package. In this case,
the compiler adds the information to the installation notes. You can edit installation notes in the
Additional Installer Options section of the app. To remove the installation note text, deselect the
support package with the third-party dependency.
Caution Any text you enter beneath the generated text will be lost if you deselect the support
package.
3-9
3 Customizing a Compiler Project
support package folder. For example, if your function uses the OS Generic Video Interface
support package, run the following command:
Some support packages require third-party drivers that the compiler cannot package. In this case,
you are responsible for downloading and installing the required drivers.
3-10
4
Warning The option to build and package MATLAB code from within the Function Wizard for Excel
add-ins will be removed in a future release. To create an Excel add-in, use the Library Compiler app.
If your MATLAB function is ready to be deployed on page 5-9 and you have already built your add-
in and COM component, follow this workflow to incorporate your built COM component into
Microsoft Excel using the Function Wizard. To follow the workflow in this section effectively, you must
run “Create Excel Add-In from MATLAB” on page 2-8.
The Function Wizard also allows you to iteratively test, develop, and debug your MATLAB function.
Using this end-to-end workflow assumes you are still in the process of developing your MATLAB
function for deployment. See “End-to-End Deployment of MATLAB Function” on page 4-16 for
complete instructions for this workflow.
See “Choose Function Deployment Workflow” on page 2-7 for further details.
4-2
Execute Functions and Create Macros
Task Reference
1. Install the Function Wizard. “Installation of the Function Wizard” on page 4-
3
2. Start the Function Wizard. “Function Wizard Start-Up” on page 4-4
3. Select the option to incorporate your built “Workflow Selection for MATLAB Functions
COM component into Microsoft Excel. Ready for Deployment” on page 4-5
4. Define the new MATLAB function you want to “Defining Functions Ready to Execute” on page 4-
prototype by adding it to the Function Wizard and 5
establishing input and output ranges.
5. Test your MATLAB function by executing it “Function Execution” on page 4-13
with the Function Wizard.
6. Create a macro. “Macro Creation” on page 4-13
7. Execute the macro you created using the “Macro Execution” on page 4-13
Function Wizard.
8. Optionally inspect or modify the Microsoft “Microsoft Visual Basic Code Access (Optional
Visual Basic code you generated with the COM Advanced Task)” on page 4-14
component. Optionally, attach the macro you
created to a GUI button.
The Function Wizard provides an intuitive interface to Excel worksheets. You do not need previous
knowledge of Microsoft Visual Basic for Applications (VBA) programming.
The Function Wizard reflects any changes that you make in the worksheets, such as range selections.
You also use the Function Wizard to control the placement and output of data from MATLAB functions
to the worksheets.
Note The Function Wizard does not currently support the MATLAB sparse, and complex data
types.
After you install the Function Wizard, the entry MATLAB Functions appears as an available
Microsoft Excel add-in button.
4-3
4 The Function Wizard
3 In the Excel Options dialog box, on the left navigation pane, select Add-Ins.
4 In the Manage drop-down, select Excel Add-Ins, and click Go.
5 In the Add-Ins dialog box, click Browse.
6 Browse to matlabroot/toolbox/matlabxl/matlabxl/arch, and select
FunctionWizard2007.xlam. Click OK.
7 In the Excel Add-Ins dialog, verify that the entry MATLAB Compiler Function Wizard is
selected. Click OK.
8 Ensure the Home tab of the Microsoft Excel Ribbon contains the Function Wizard tile.
If the Function Wizard was not previously installed, click Browse and navigate to matlabroot
\toolbox\matlabxl\matlabxl folder. Select FunctionWizard.xla. Click OK.
In Microsoft Excel, on the Microsoft Office ribbon, on the Home tab, select Function Wizard.
You can also access Function Wizard from the File tab.
1 Select File > Options > Add-Ins from the Excel main menu.
2 Select Function Wizard.
4-4
Execute Functions and Create Macros
1 From the Function Wizard Start Page, select the option I have an Add-in component that was
built in MATLAB with the Deployment Tool that I want to integrate into a workbook.
2 Click OK. The Function Wizard Control Panel opens with the Add Function button enabled.
The Function Wizard Control Panel for Working with MATLAB Functions Ready for Deployment
Tip To return to the Function Wizard Start Page, click Start Over.
4-5
4 The Function Wizard
3 Select the function you want to execute (mymagic) from the box labeled Functions for Class
xlmagic.
4 Click Add Function. The Function Properties dialog box opens.
Tip The Function Syntax and Help area, in the Function Properties dialog box, displays the
first help text line (sometimes called the H1 line) in a MATLAB function. Displaying these
comments in the Function Properties dialog box can be helpful when deploying new or unfamiliar
MATLAB functions to end-users.
5 Define input argument properties as follows.
a On the Input tab, click Set Input Data. The Input Data for n dialog box opens.
b Specify a Range or Value by selecting the appropriate option and entering the value. If the
argument refers to a structure array (struct), select the option This is a MATLAB
structure array argument. See “Working with Struct Arrays” on page 4-9 for
information on assigning ranges and values to fields in a struct array.
Caution Avoid selecting ranges using arrow keys. If you must use arrow keys to select
ranges, apply the necessary fix from the Microsoft site: https://mskb.pkisolutions.com/kb/
291110.
Note Select the Auto Recalculate on Change option to force Microsoft Excel to
automatically recalculate the spreadsheet data each time it changes.
4-6
Execute Functions and Create Macros
c Click OK.
Tip To specify how MATLAB Compiler for Excel add-ins handles blank cells (or cells containing
no data), see “Empty Cell Value Control” on page 4-8.
6 Define output argument properties as follows.
a On the Output tab, click Set Output Data. The Output Data for y dialog box appears,
where y is the name of the output variable you are defining properties of.
Tip You can also specify MATLAB Compiler to Auto Resize, Transpose or output your data
in date format (Output as date). To do so, select the appropriate option in the Argument
Properties for y dialog box.
b Specify a Range. Alternately, select a range of cells on your Excel sheet; the range will be
entered for you in the Range field.
Caution Avoid selecting ranges using arrow keys. If you must use arrow keys to select
ranges, apply the necessary fix from the Microsoft site: https://mskb.pkisolutions.com/kb/
291110.
c Select Auto Resize if it is not already selected.
d Click Done in the Output Data for y dialog box.
e Click Done in the Function Properties dialog box.
4-7
4 The Function Wizard
mymagic now appears in the Active Functions list of the Function Wizard Control Panel.
You can specify how MATLAB Compiler processes empty cells, allowing you to assign undefined or
unrepresented (NaN, for example) data values to them.
4-8
Execute Functions and Create Macros
1 If you have not already done so, select This is a MATLAB structure array argument in the
Input Data for n dialog box and click OK.
The Input Data for Structure Array Argument n dialog box opens.
4-9
4 The Function Wizard
2 The Function Wizard supports Vector and Two-dimensional struct arrays organized in either
Element by Element or Plane organization, for both input and output.
In the Input Data for Structure Array Argument n dialog box, do the following:
a In the Structure Array Organization area, select either Element by Element Organization
or Plane Organization.
b Click Add Field to add fields for each of your struct array arguments. The Field for
Structure Array Argument dialog box opens.
4-10
Execute Functions and Create Macros
a In the Name field, define the field name. The Name you specify must match the field name
of the structure array in your MATLAB function.
b Specify the Range for the field.
Caution Avoid selecting ranges using arrow keys. If you must use arrow keys to select
ranges, apply the necessary fix from the Microsoft site: https://mskb.pkisolutions.com/kb/
291110.
4-11
4 The Function Wizard
c Click Done.
The product converts data passed into structure arrays in element-by-element organization or plane
organization. See MATLAB Programming Fundamentals for more information about all MATLAB data
types, including structures.
If you are a MATLAB programmer and want to deploy a MATLAB function with structure arrays as
input or output arguments, build Microsoft Excel macros using the Function Wizard and pass them
(with the Excel add-in and COM component) to the end users. If you can’t do this, let your end users
know:
The macro generation feature of MATLAB Compiler for Excel add-ins works with struct arrays as
input or output arguments. See “Macro Creation” on page 4-13 if you have a MATLAB function you
are ready to deploy. See “Microsoft Excel Add-In and Macro Creation Using the Function Wizard” on
page 4-33 if you are using the Function Wizard to create your MATLAB function from scratch. See
“Choose Function Deployment Workflow” on page 2-7 for more information on both workflows.
4-12
Another Random Scribd Document
with Unrelated Content
"Marshal Zabern," said the voice of Ravenna, "as you value the
throne of the princess, come not one step farther. Mark well what is
in my hand."
The window of the oratory, which before had been shut, was now
wide open, and the moonlight fell upon the lofty figure and pale face
of the cardinal, who was standing erect on one side of the altar. In
his right hand he held a dove, to the neck of which a letter was
attached. The sight kept the three men dumb and motionless, for
they instantly divined that the bird was a carrier-pigeon.
Ravenna's Italian guile had been more than a match for Zabern's
subtlety. His object in kneeling before the altar had not been to pray,
but to release the dove which had been attached to it by a silken
thread—a dove purposely kept for emergencies. What captain of the
guard on arresting the archbishop would be so stern-natured as to
refuse his prisoner a few minutes' prayer in his private oratory?
Ravenna, on releasing the dove, had affixed the letter to its neck,
performing the feat so guardedly, that though he had been watched,
now by Zabern, and now by Nikita, his movements had not given
rise to suspicion.
"Listen," cried Ravenna, raising his left hand warningly. "If you enter
I quit my hold of the dove. You observe the letter. Let me tell you
what it contains."
"Say on," returned Zabern with affected indifference. "Your ten
minutes have not yet expired."
"This evening," began the cardinal, "and just prior to your arrival I
penned a letter intended for the Czar's perusal. That letter now
hangs from this dove's neck. It contains three statements. Firstly,
that the Princess of Czernova is not Natalie Lilieska; secondly, that
the Czernovese Charter is a forgery from the hand of Katina
Ludovska; thirdly, that the Convent of the Transfiguration contains
ample evidence of a conspiracy for the emancipation of Poland. Each
of these facts, singly, if known to the Czar, would be sufficient to hurl
the princess from her throne. If this dove should fly forth it would be
in my nephew's house at Zamoska within thirty minutes; an hour
more, and Redwitz would be in the camp of the Czar. Thus, then, do
I make my terms. Approach to do me hurt, and I release the dove.
Retire from the palace, give me my life, and I swear by all that I
hold holy to refrain from endangering the throne of the princess. It
is within your power to murder me, but the murder will be dearly
purchased, for it will bring utter ruin upon Czernova."
"Idle vaunting!" said Zabern. "All know that the carrier-pigeon flieth
not in the dark."
"This dove has ere now found its way to Zamoska by moonlight."
That the cardinal spoke truth when he declared that the letter
contained the weighty secrets Zabern did not doubt. Therefore to
advance with intent to slay would be fatal to the interests of the
princess; and yet to retire, leaving Ravenna to his own devices
would be equally fatal, for Zabern knew full well that the cardinal's
most solemn oath was not to be trusted. So soon as the trio should
withdraw, so soon as Ravenna should be released from the fear of
their presence, he would laugh at their simplicity, and would carry
out his evil work against the princess, ay, and with more
determination than ever, embittered as he would be by the attempt
made upon his life. It was a terrible dilemma.
The trio stood upon the threshold of the oratory, immovable,
irresolute, silent, gazing at the cardinal, who in turn kept his eyes
fixed upon them like a prisoner waiting for the verdict of life or
death.
"No terms with a Jesuit," muttered Zabern under his breath. "Nikita,
you are the best shot. Draw your pistol, and shoot, not the cardinal,
but the dove."
As Zabern spoke he moved slightly to one side, in order to screen
the movements of his henchman.
Directly afterwards a report rang out, startlingly loud in that small
chamber. It was accompanied by a sharp cry of anguish from the
cardinal, and by a swift forward rush on the part of his foes, each
eager to pounce upon the fallen bird.
But, by a strange mischance, Nikita, who was considered to be
second only to Katina herself in the handling of the pistol, had
somehow failed to hit a conspicuous object seventeen feet away.
The bullet had penetrated the wrist of the cardinal, whose hand had
involuntarily relaxed its hold, with the result that the startled dove
was now flying forth through the open casement.
With the air of one mad, Zabern pulled Nikita towards the window,
and, hurling Ravenna aside, he thrust his own pistol into the
trooper's hand.
"Shoot, Nikita, shoot in God's name," he cried, pointing to the dove,
whose white form was clearly defined against the dark blue sky.
"The fate of all Czernova rests on your aim."
The bird, as if doubtful what direction to take, was moving slowly
round in a series of spirals and rising higher and higher each
moment. Nikita pointed his weapon, raising it gradually with the
ascent of the dove, till, deeming himself certain of his aim, he drew
the trigger. A second shot rang out. Both men looked, expecting the
instant fall of the dove, but the winged messenger remained unhurt,
and apparently having chosen its route, flew off in a straight line,
and immediately disappeared over the tree-tops.
"By heaven, you've missed again!" cried Zabern, his dismay being
lost for the moment in wonder that Nikita's hand should have so
strangely lost its cunning.
"God's curse is on me to-night," said Nikita, flinging the pistol from
him. "Who," he added, with a touch of Slavonic superstition, "who
can shoot a dove, symbol of the Holy Ghost?"
"Symbol of the holy devil!" cried Zabern. "Where's the cardinal?"
In his eagerness to mark the effect of Nikita's second shot Gabor
had likewise pressed forward to the casement, forgetful of Ravenna,
who, taking advantage of this negligence, picked himself up from the
corner where Zabern had flung him, and ran from the oratory into
the library. The wondering police next day traced his course over the
carpet by the blood-drops that fell from his shattered wrist.
But in a moment more the avenging Zabern was after him, his sabre
gleaming in his hand.
The cardinal had reached the locked door of the library: his
unwounded hand had turned the key; his fingers were already upon
the door-handle when Zabern, with a laugh of horrid glee, clutched
him by the collar of his cassock with the same hand that held the
sabre, and pulled him backward upon his knees.
The agony of the situation forced from Ravenna a yell that curdled
the blood of the treacherous steward who kept watch at the foot of
the staircase, but it had no effect upon Zabern.
"You paid no heed to Natalie's screams, nor will I to yours."
He thought no more now of safeguarding himself by imparting to the
murder the appearance of suicide.
"To hell, and say that Zabern sent you."
Foaming with fury, he dealt not one, but many strokes at the
kneeling, swaying figure, with its feebly upraised hands. Nikita and
Gabor, equally frenzied, joined in the savage work.
The three miserable men wiped their bloody sabres upon the
window-curtains, and stared down upon the carpet at something
which had once been a man.
The clock-tower of the cathedral now sent forth the sweet and pretty
carillon that always heralded the striking of the hour. Then after a
solemn interval came the first peal of midnight.
"The princess's coronation day!" said Nikita.
"Humph! will there be any coronation?" muttered Zabern.
"Hark to the shouting!" said Gabor.
From every quarter of the capital, from the groups moving to and fro
along the route of the intended procession, from spacious square
and narrow alley, from the brilliantly illuminated hotel, and from the
obscure private dwelling, came the sound of cheering, gradually
swelling into one prolonged universal roar. The gala-day had come at
last!
Zabern with a grim smile looked towards the north. The heaven in
that direction was tinged with a red glow from the thousands of
watch-fires in the Czar's camp—that camp towards which the swift-
flying dove was now winging its course with the tidings fatal to
Czernova. How long would it be ere that huge array came pouring
across the border to depose the princess, and to establish the duke
upon—
Zabern started.
Ere the shouting of the joyous populace had died away, a new and
startling sound was reverberating through the night air. It was the
boom of a single cannon, and that at no great distance. Its
significance was intuitively divined by Zabern.
"The Citadel-gun!" he cried, recoiling from the window. "By God, the
duke has escaped!"
CHAPTER XVII
You are herewith commanded to release the Duke of Bora. Delay will
mean death to you.
NICHOLAS PAULOVITCH
Czar of all the Russias.
"When I saw that signature," continued Miroslav, "I gave orders that
the visitor should be instantly admitted. On entering the room he
commanded my servant to retire, and then when he had withdrawn
the cloak from his face I saw that it was indeed the Emperor
Nicholas. 'Have you given command for the release of my kinsman?'
were his first words. Vain was it for me to protest that I could
receive such an order only from the princess herself. 'I am the
suzerain of Czernova, and therefore above the princess,' was his
reply."
"Ha!" said Barbara, with a flash of her eyes. "And you acknowledged
his suzerainty?"
"Your Highness is great, but the Czar is greater. Who is like the
mighty Nicholas?"
"No one on earth, Miroslav; for which fact may the saints be
praised!" remarked Zabern.
"Your Highness, I was so awed by the emperor's majestic presence,
by his authoritative manner, by the thought of his empire and power
that I could not do otherwise than obey him. The marshal himself
would have done the like, had he been in my place."
Zabern repudiated the statement with a scornful laugh.
"I brought the duke to the presence of the emperor, and the two
withdrew, going I know not where. Fearing your Highness's
displeasure, I myself quitted the Citadel, intending to fly from
Czernova. I throw myself upon your Highness's mercy."
"It was your duty, Miroslav," returned Barbara, "to retain your
prisoner, even at the hazard of your life. In taking orders from a
foreign sovereign you have committed an act of treason. Gabor, see
that the governor be kept in the palace here till our return from the
cathedral. We will then decide as to his punishment."
Gabor saluted, and the troop retired with their prisoner.
"The Czar secretly in our city!" murmured Radzivil, in a tone of
dismay. "What is his object?"
"No good to our rule, count," replied Barbara, quietly.
The secret visit of the Czar to Slavowitz, and his act in releasing the
Duke of Bora, had so sinister an aspect that the hopeful ones among
the ministry returned at a bound to their previous state of doubt.
Were they about to witness a coronation or a dethronement? Was
the Czar preparing to intervene in the ceremony? Would the
solemnity in the cathedral end amid the mockery and the triumph of
the Muscovite faction? With a feeling of pity they glanced at their fair
young ruler, who for her part showed no sign of fear in this great
crisis. They recognized that if she should fall, she would fall with
dignity.
The breakfast ended, and Barbara retired to dress for the coming
ceremony.
Outside, in the wide extent of ground fronting the Vistula Palace, the
long line of the procession was slowly forming under the direction of
marshals and heralds.
Part of the procession consisted of a sort of historic pageant; its
members, attired in costumes that recalled every period of Polish
history, carried trophies and emblems, calculated to stir the patriotic
enthusiasm of the populace.
In this pageant Katina Ludovska bore part, by far the most charming
of the maidens present, clad as she was in a dainty corselet of
silvered mail, above a dark-blue satin skirt flowered with gold.
Mounted upon a beautiful bay, she bore proudly aloft a famous
historic memorial, a standard captured by King Sigismund at the
taking of Moscow, its white silken folds distinctly stamped with the
impress of a bloody hand, a ghastly testimony to the struggle that
had once raged around it.
In riding along the line of the procession, Zabern stopped and
addressed a few words to his affianced.
"Not pasteboard and tinsel, I trust?" he said, with a smile, and
referring to the sword by her side.
"Real steel," replied Katina, exhibiting the blade.
"Good! 'Tis well to go armed on such a day as this. We shall be
fighting for our liberties ere long."
"Death before submission," replied Katina, with a brave light in her
eyes that made Zabern love her the more.
The din caused by the marching of soldiers, the neighing of steeds,
the rolling of carriage-wheels, the snarling of silver trumpets, the
crisp, sharp word of command floated upward to Barbara's ears as
she sat undergoing her toilet at the hands of her ladies. She
wondered, as she had wondered many times that morning, how it
would all end, for assuredly no coronation could ever have been
heralded with more sinister auspices than her own.
Partly with a view to picturesque effect, and partly that the populace
along the line of route might have a clear and uninterrupted view of
their princess, it had been decided that she should proceed to the
cathedral mounted upon a white palfrey.
Barbara had been somewhat disposed at first to shrink from this
exposure to public gaze, but had finally consented to the
arrangement, won over by the argument that as the people would
assemble for the express purpose of seeing her, it would be a
disappointment to them to catch but a glimpse of their ruler through
the windows of a state-coach.
To Radzivil and Zabern had been given the honor of riding side by
side with the princess, though the marshal cared much less for the
honor than for the opportunity afforded him of exercising guard over
her person, since he was not without apprehension that some
fanatic Muscovite might attempt her life during her progress through
the streets.
The procession was timed to start at ten o'clock, and as the hour
drew near Zabern and the premier rode to the entrance of the
palace, and there waited the coming of the princess.
The marshal was mounted upon a magnificent black charger, and
made a splendid figure, for he wore the old picturesque Polish
costume, and sparkled with diamonds from plume to spur.
"And to think," he mused in the interval of waiting, "to think that
Captain Woodville has not yet arrived."
"Captain Woodville?" exclaimed the premier with a start. "Surely the
princess is not recalling him?"
"No, but I am; and his non-arrival is a grave matter for us. Were the
duke still in the Citadel, Woodville's absence might be borne with
equanimity. As it is—but here comes the princess. I must defer my
explanation."
Punctually at one minute to ten, Barbara appeared at the entrance
of the palace, and descending the marble stairs, she mounted her
white palfrey with the assistance of Radzivil.
Zabern at the same moment waved his plumed cap, and
immediately a salvo of artillery from the roof of the palace
proclaimed to the waiting populace that the princess was about to
set off.
Amid the roll of drums, the crash of music, and the pealing of bells
from every steeple in the city, the great brazen gates of the palace
gardens were flung wide, and there rode forth the head of the
procession, the Blue Legion, their lances flashing brightly in the
sunlight.
As they moved out, the sight that met their eyes was sufficient to
stir the blood of the most sluggish. The centre of the road was
empty, but the sidewalks were literally paved with human heads.
Every window, balcony, and roof was alive with spectators. All
Czernova was there, every citizen apparently determined to find a
place somewhere along the line of route. Resolved to obtain a view
somehow of their youthful sovereign, men could be seen clinging in
mid-air to steeples, pediments, cornices, wherever foothold could be
found. From the ground below to the sky above nothing but human
faces.
"Sword of Saint Michael!" muttered Zabern. "A pity all have not been
trained to use the rifle. We might, then, make good defence, even
against the Czar's one hundred thousand."
As soon as Barbara made her appearance, she was greeted with
frenzied cheering. Roar after roar rent the air. Rolling along the
boulevard, and mounting upward to the sky, the sound was almost
loud enough to be heard in the distant camp of the Czar. So great
was the enthusiasm that the troops lining the streets could with
difficulty prevent the populace from pressing forward to touch her.
If any dissentients to her rule were present along the line of route,
they were careful to dissemble their feelings. But who could dissent
from a maiden so sweet and fair? Dressed simply in white silk, she
looked every inch a princess. Her dark hair was without covering,
save for a slender gold diadem, from which there flowed behind a
veil of diaphanous lace.
Tears glistened in eyes that had not been wet for years.
Aged men who had seen the great Kosciusko carried off from the
fatal field of Macicowice; veterans who, like Zabern, had marched
with Napoleon to the fall of Moscow; fugitives from Siberian mines,
with bodies scarred by the iron fetters they had worn; Polish
patriots, survivors of the ill-starred rising of '30—all were gathered
that day in the Czernovese capital to acclaim one destined, so they
believed, to revive the ancient empire of Poland. Many a salute did
Zabern give, as from time to time he caught sight among the crowd
of the face of some old familiar-in-arms.
Barbara, however, though smiling sweetly upon all around, was
inwardly unhappy. A secret voice seemed to whisper, "Deceiver! this
tribute of loyalty is offered to Natalie Lilieska, the lawfully born
daughter of the Princess Stephanie, and not to the Barbara of
doubtful origin."
It was too late now to recede from the rôle she had assumed, and
so amid shouting multitudes she rode on, her progress from the
palace to the cathedral being one continuous scene of triumph,
unmarred by anything of a hostile character.
"It is here, then, that we are to look for the Czar's coup?" muttered
Zabern, as the cavalcade drew in sight of the stately Gothic
cathedral of Saint Stanislas, from every tower of which silver-
tongued bells were pealing jubilant carillons.
Those in the procession whose duty or privilege it was to enter the
cathedral, made their ingress by various doors to their appointed
places; the less fortunate remained drawn up in order around the
edifice.
As Zabern stood upon the broad flight of steps, carpeted with
crimson velvet, and surveyed the vast crowds around, his attention
was suddenly arrested by the sight of a horseman at the far end of a
boulevard which opened upon the cathedral square. As this avenue
was kept clear by the military for the return journey of the princess,
there was nothing to impede the rider's progress, and on he came
with flying rein and bloody spur.
"A courier! a courier!" cried the people, instinctively divining that he
was the bearer of weighty tidings. "What news? What news?"
To their cries, however, the rider remained mute.
"By heaven, it's Nikita!" muttered the marshal.
As the quivering steed drew up at the foot of the cathedral-stairs,
Zabern sprang to meet his orderly.
"Now, marshal," said the latter, "play the Roman, and fall on your
sword's point, for the end has come."
"A good many men shall fall by this blade ere it reaches my heart,"
growled Zabern. "What new trouble do you bring?"
"The chanting of the monks hath ceased; or to be plainer, the
Russian standard is floating over the Convent of the Transfiguration."
"Speak you from hearsay merely?"
"I speak of what I have seen."
"The cardinal laughs at us from hell; this is the first result of his
letter. The Russian invasion has begun, then? Pretty generalship on
the part of Dorislas to let the enemy steal thus upon his rear! And
where are the monks, that they have not fired the powder-
magazine, and sent themselves and their foes flying into the air?
They have sworn an oath to do it rather than let the convent fall into
the hands of the enemy. There would not now have been one stone
upon another if old Faustus had been there."
"It was when on my way back from the camp of Dorislas that I
caught sight of the Muscovite standard on the tower of the convent.
I immediately rode near and perceived the bayonets of the Paulovski
Guards moving to and fro along the battlements. And who should be
in command there but Baron Ostrova, the duke's former secretary—
he whom the princess banished from Czernova. I at once galloped
back to our camp with the news. Dorislas instantly set off with a
thousand men; he has invested the convent; his artillery are ready
planted for shelling the place, and he now awaits orders from you."
"'Orders'?" repeated Zabern with contempt. "My orders should be,
'Consider yourself cashiered for incompetence.' How many Russians
do you suppose there are in the convent?"
"I cannot state the number, marshal—sufficient evidently to
overpower the monks, and to hold the place in case of siege."
"And the rest of the Czar's forces?"
"Are abiding quietly in their camp on the other side of the frontier."
"Gladly would I come, Nikita, to direct operations, but that I dare not
leave the side of the princess, for there is more danger to be
apprehended here than before the convent. Dorislas shall see me
with all speed as soon as the coronation is over. Meantime here are
his orders."
And the marshal wrote upon a slip of paper: "Maintain cordon till my
arrival. Do nothing unless attacked.—ZABERN."
Taking the note, Nikita rode off, his breakneck pace along the
boulevard again exciting the wonder of the populace.
"This holding of the coronation while the foe is on Czernovese
ground might seem a jest to some," murmured Zabern; "yet if, as I
am hoping, the ceremony should tempt the Czar to come forward
personally to oppose the princess's rights, then all may yet be well.
Since Nicholas has chosen to make an armed raid upon our territory,
let him not complain if he should find himself a prisoner of war. And
with the Czar in our hands we shall be masters of the game."
On turning to enter the porch, Zabern was met by the chief court
official, to whom had been committed all the arrangements
connected with the coronation.
"Marshal, the cathedral is full to overflowing, and yet there are
hundreds at the northern porch clamoring for admittance, and all
provided with proper orders."
"Very bad arrangement on your part."
"Not so, marshal. The tickets issued did not exceed the seating
accommodation."
"Ha!" said Zabern, alive to the significance of this statement; "you
mean that there are several hundred persons within who have no
right to be there?"
"That is so, marshal. The whole body of the northern transept is
filled with men who, I am certain, have gained entrance by means of
forged orders. Among these men I recognize many Muscovites, not
ruffians from Russograd, but Muscovites of the nobler and wealthier
class."
"So!" murmured Zabern. "Their plot of the barricades having been
forestalled and thwarted, the enemy are resorting to new
manœuvres."
"Some are in uniform, and some in court dress, and hence they are
armed with swords. If we should attempt to expel them there will be
opposition, tumult, possibly bloodshed. What's to be done?"
"At present, nothing. Let us, if possible, avoid a riot. If they choose
to remain orderly, good; but if it be their object to oppose the
coronation by armed force, then their blood be upon their own
heads."
"And the multitude at the northern porch?"
"Will have to remain there, I fear," replied Zabern, shrugging his
shoulders.
He passed from the porch to the interior of the edifice.
The scene within fairly dazzled the eye. The rich dresses of the
ladies, the splendid military costumes of the men, formed a picture
glowing with color; on all sides were to be seen the sparkle of jewels
and the gleam of scarlet and gold.
As Zabern slowly made his way towards his allotted seat in the choir,
he did not fail to notice certain mocking glances cast at him by the
occupants of the northern transept. Mischief was evidently the
object of their assembling; but inasmuch as they were inferior in
number to the Poles present, and as a word on his part could
instantly set in motion the military both inside and outside the
cathedral, Zabern viewed this Muscovite gathering without any
alarm.
The chancel, elevated considerably above the general level of the
cathedral-pavement, was the cynosure of all eyes.
On the altar were the sacramental vessels, the princely regalia, and
the document supposed to be the original Czernovese Charter, never
publicly exhibited, except at a coronation.
To the left of the altar was an oaken chair in which the princess
would sit, till the time came for her to take her place on the throne.
Respectively north and south of the altar, and each vying with the
other in splendor of vestment, stood the two ecclesiastics who were
to officiate in the ceremony, the Greek Archpastor Mosco, and the
mitred Abbot Faustus; the latter a good man, and a stern old patriot,
quite capable, as Zabern had said, of blowing himself to fragments,
if Polish interests should require such sacrifice.
While Zabern from his place was intently studying the occupants of
the northern transept, under the belief that the Czar was concealed
somewhere among them, a small door in the left wall of the choir
opened, and Barbara entered, bare-headed, and clothed in her
coronation-robe,—a vestment of purple velvet, bordered with
ermine, and gleaming with pearls. Four ladies attended her as train-
bearers.
Awed by the solemnity of the occasion, she was very pale, and with
the glory of the sunlight illumining her figure as she moved forward
with slow and majestic pace, she seemed to her adherents afar off
like a fair vision from another world.
According to the prescribed ritual, the first part of the ceremony
consisted in reading a chapter from one of the Four Evangelists, a
duty which by previous arrangement fell to the lot of Mosco.
As soon, therefore, as Barbara had taken her place in the oaken
chair, she glanced at the archpastor as a sign for him to begin.
Now great importance was attached both by the Poles and the
Muscovites to this reading of the Gospel. The lection was neither
appointed beforehand nor chosen by the ecclesiastic officiating; it
was left to the guidance of chance, or rather, as the Czernovese
themselves believed, to the will of the Deity. The lector, following a
usage of mediæval times, was required to open the holy volume at
random and to read the first chapter upon which his eye should
happen to light. It was believed that the portion thus hit on would
contain something applicable to the person crowned or even
prophetic of the character of the reign.
As Mosco with dignified bearing moved to the lectern, he passed
close to Zabern, whose quick ear instantly detected a peculiar sound
beneath the archpastor's brocaded and jewelled cassock,—a sound
which the marshal could liken only to the trail of a steel scabbard.
"As I live the fellow is armed," he muttered. "A holy prelate with a
sword beneath his gown! There's treason here."
Zabern's first impulse was to spring up, and tearing off Mosco's
gown, to expose him to the assembly as an armed conspirator.
It might be, however, that, like himself, the archpastor anticipated
that there would be rioting and fighting at the coronation, and hence
he had as much right as others to carry arms for his own defence.
Zabern therefore refrained from violence, but his keen eyes were
attentive to every movement of Mosco.
On the brazen lectern, which stood upon the edge of the choir,
directly facing the assembly, lay a volume of the Four Evangelists,
closed and clasped.
Mosco unfastened the clasp, and then evidently wishing to be
thought clear of all suspicion of designedly choosing his lection, he
turned away his head, and with nimble fingers threw open the
volume; and yet in spite of this, Zabern was impressed with the
belief that the Greek prelate knew beforehand at what page the
book was open. He had not forgotten that this reading of the Gospel
had been selected by Mosco himself as his part in the coronation-
ceremony, and he recalled the archpastor's peculiar smile at the time
of his choosing the office. Was the mystery about to be solved?
Turning his eyes upon the opened volume, Mosco began to read.
The lection obtained by this sors sacra proved to be the opening
chapter of the Fourth Gospel.
With a curious anticipatory interest the assembly listened to the
reading, prepared to catch at any verse which might be twisted into
some allusion to the princess and her reign.
Mosco, in a magnificent bass voice and with majestic delivery, read
through five verses. Then, making a momentary pause, he resumed,
changing his tone to one of peculiar emphasis,—
"'There was a man sent from God whose name was John—'"
"And there he is!" cried a voice that rang like a clarion all over the
cathedral, the voice of Feodor Orloff; "there he is! John, Duke of
Bora. People of Czernova, listen to the voice of God."
Scarcely had the words been spoken when the Duke of Bora was
seen emerging from the northern transept.
CHAPTER XVIII
ebookbell.com