User`s guide

Building a Deployable Application
not specify the class name (<class_name>), mcc uses the component name as
the default. If you do not specify a version number,
mcc uses the latest version
built or 1.0, if there is no previous version.
The following ex ample shows the
mcc command used to create a COM
component called
mycomponent containing single COM class named myclass
with methods foo and bar, and a version of 1.0. The -T option tells mcc to
create a DLL.
mcc -W 'excel:mycomponent,myclass,1.0' -T link:lib foo.m bar.m
To generate an Excel-compatible formula function for each M-file, specify the
-b option on the command line, as follows:
mcc -W 'excel:mycomponent,myclass,1.0' -b -T link:lib foo.m bar.m
As an alternative, you can also use the cexcel bundle file to simplify the
command line. In the example, note how you do not need to specify the
-T
or the -b options.
mcc -B 'cexcel:mycomponent,myclass,1.0' foo.m bar.m
Testing the Component
After you build a component, you can test yo ur software by importing the
VBA file (
.bas) into the Excel Visual Basic Editor and invoking one of the
functions from the Excel worksheet.
To import the VBA code into Excel’s Visual Basic Editor, open Excel and
select Tools > Macros > Visual Basic Editor.FromtheVisualBasic
Editor, select File > Import and select the created VBA file from the
<project_dir>\distrib directory.
The Visual Basic module created when you build the project contains the
necessary initialization code and a VBA formula function for each M ATLAB
function processed. Each supplied formula function wraps a call to the
respective compiled function in a format that can be accessed from a cell
in an Excel worksheet. The function takes a list of inputs corresponding to
the inputs of the original MATLAB function and returns a single output
corresponding to the first output argument.
1-7