User`s guide

1 Overview
1-8
Building a Project
After you define your project settings and add the desired M- and MEX-
functions, you can build a deployable DLL and the necessary Visual Basic for
Applications (VBA) code that allows Excel to access the DLL. Choosing
Build -> EXCEL/COM Files or clicking the Build button invokes the MATLAB
Compiler, writing the intermediate source files to
<project_dir>\src and the
output files necessary for deployment to
<project_dir>\distrib.
Build Status
The Build status panel shows the output of the build process and informs you
of any problems encountered. The files appearing in the
<project_dir>\distrib
directory will be a DLL and a VBA file (.bas). The
resulting DLL is automatically registered on your system.
To clear the
Build status panel, select Build -> Clear Status. The output of
the build process is saved in the file
<project_dir>\build.log. To open the
Build Log, choose
Build -> Open Build Log. The Build Log provides a record
of the build process that you can refer to after you have cleared the
Build status panel. If you ever contact MathWorks Technical Support with a
question about the build process, you will be asked to provide a copy of this log.
Testing the Model
At this point, you can test the model 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 Excels Visual Basic editor, open Excel
and choose
Tools -> Macros -> Visual Basic Editor. From the Visual Basic
editor, choose
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 MATLAB
function processed. Each supplied formula function essentially wraps a call to
the respective compiled function in a format that can be accessed from a cell in
an Excel worksheet. This 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. Formula functions of this type are
most useful to access a function of one or more inputs that returns a single
scalar value. When you require multiple outputs or outputs representing
ranges of data, you need a more general Visual Basic subroutine. For a more