0% found this document useful (0 votes)
88 views6 pages

Excel Link For Matlab

The document discusses the Excel Link add-in, which allows Excel and MATLAB to communicate bidirectionally. It provides functions to transfer data between Excel and MATLAB, execute MATLAB commands from Excel, and manage the link. Once installed, the link starts automatically whenever Excel opens. Examples demonstrate using it to fit a polynomial model to data, calling its functions from VBA macros, and doing processing primarily in MATLAB after transferring the data. The document recommends using Excel Link when data management is easier in Excel but MATLAB capabilities are needed, such as for advanced numerical methods.

Uploaded by

Marcial
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views6 pages

Excel Link For Matlab

The document discusses the Excel Link add-in, which allows Excel and MATLAB to communicate bidirectionally. It provides functions to transfer data between Excel and MATLAB, execute MATLAB commands from Excel, and manage the link. Once installed, the link starts automatically whenever Excel opens. Examples demonstrate using it to fit a polynomial model to data, calling its functions from VBA macros, and doing processing primarily in MATLAB after transferring the data. The document recommends using Excel Link when data management is easier in Excel but MATLAB capabilities are needed, such as for advanced numerical methods.

Uploaded by

Marcial
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Excel Link

O
L
E

E
OL
E
OL

the Excel Link add-in


Theme: interconnectivity

Excel Link
toolbox available with Matlab, but actually an Excel add-in
installing the Excel Link add-in

exclink.xla

Excel Link toolbar


appears

Excel 2002
Project
Workbook
Module

Matlab
Matlab
workspace

11 functions used to
manage link and
manipulate data

Excel environment
is the front end

Matlab operates
in the background

Once Excel Link is installed, its add-in functions and Matlab


will start whenever Excel is started, unless you enter into a
cell the formula command =MLAutoStart(no)
To restart the link manually, run the matlabinit macro from
Tools
Macro
Run or enter =MLOpen() in a cell
To close the link manually, enter the formula =MLClose()

Excel Link Data Management Functions


MLAppendMatrix
to copy data from Excel over
MLPutMatrix
to Matlab
MLPutVar
MLGetMatrix
MLGetVar

to copy data from Matlab back


to Excel

MLDeleteMatrix

to delete a Matlab variable

MLEvalString

execute a Matlab command


from Excel

MLPutVar and MLGetVar can be invoked only from VBA


you must check EXCLLINK.XLA from VBE:Tools/References
Excel Link functions perform an action, they do not return
a value, as do standard Excel functions
If the Excel Link function executes successfully, a 0 will
4
show in the cell

Example 1: linking from Excel to Matlab for a polynomial fit

Example 2:

Using Excel Link functions from VBA

Setting up
References
to Excel Link
in the VBE

Set up an array function to return the model coefficients


= ModelFit(xdata,ydata,degree)
Ctrl-Shift-Enter

Example 3: Doing most of the work in Matlab

just transfer the data to


Matlab and then go
there to do the work

10

the Excel-based
data are here

11

When to use Excel Link?


when its convenient to store and manage data in Excel
when Matlabs capabilities can be used to advantage
for example,

solving algebraic equations


optimization
integration (quadrature)
solving differential equations
other advanced numerical methods

12

You might also like