Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have defined two matrices InMatrix1 and InMatrix2 on a spredsheet by names.
The programme does not execute. When I type UBound in the VBEditor, there is no prompt for the UBound word after I press shift+spacebar. What is the problem? Function MatrixMult(InMatrix1 As Variant, InMatrix2 As Variant) As Variant 'generic matrix multiplication engine, pure BASIC code Dim OutMatrix() Dim i As Integer, k As Integer Dim j As Integer Dim Sum As Integer ReDim OutMatrix(1 To UBound(InMatrix1, 1), 1 To UBound(InMatrix2, 2)) Application.Volatile 'force recalculation with spreadsheet For i = 1 To UBound(InMatrix1, 1) 'rows of inmatrix1 For j = 1 To UBound(InMatrix2, 2) 'cols of inmatrix2 Sum = 0 For k = 1 To UBound(InMatrix1, 2) Sum = Sum + InMatrix1(i, k) * InMatrix2(k, j) Next OutMatrix(i, j) = Sum Next Next MatrixMult = OutMatrix End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Ubound matrix | Excel Programming | |||
Why is this returning a Ubound value of zero | Excel Discussion (Misc queries) | |||
UBound | Excel Programming | |||
Array Ubound | Excel Programming | |||
Ubound & Lbound | Excel Programming |