Databases Reference
In-Depth Information
Any element within a matrix or vector can be referenced using (row, column) notation. For
example, in matrix A, 9 could be replaced with 8 by typing the following command:
A(2,2) = 8
Recall that in Excel VBA, Worksheet cells are referenced by the Cells form of the Range
method, which also denotes cell location in the row, column format. Worksheets can easily be set
up to hold vector or matrix elements and transfer them to Matlab upon command. Matlab, in fact,
has a tool called the Array Editor that allows users to view matrix and vector elements in an Excel
Worksheet type of format. (See Figure 9.2) A sample application will be set up to show the reader
how to define matrix and vector objects in Matlab remotely from the Excel environment.
9.4
DEFINING MATRICES AND VECTORS IN MATLAB FROM EXCEL
A sample application can now be constructed that will allow the user to define any matrix or vector
entity in Matlab remotely using an ActiveX server. Figure 9.3 shows the GUI for the sample
application that allows matrices and vectors to be defined from within Excel. The sample matrix
building tool can be run by selecting A DA->Chapter 9 ->Matlab Matrix B uilder, which will bring
up the GUI shown in Figure 9.3.
The GUI in Figure 9.3 allows the user to select what is to be defined — a matrix or a vector.
If a matrix is selected, the mapping variable is converted to uppercase. If a vector is selected, the
mapping variable is converted to lowercase, and the user must choose between a column or row
FIGURE 9.3
The matrix builder sample application.
Search WWH ::




Custom Search