Posted Wednesday, March 17, 2004 7:38 PM
|
|
|
|
I've downloaded your software and am having problems with the times method. I want to multiply a 3x3 matrix by a 3x1 matrix and get a type mismatch error. Your help file says that " The number or rows of Matrix2 parameter must be equal to number of columns of current Matrix" which I believe is the case.
The code I have used is:
Dim M1, M2, M3, M4 As Matrix
Set M1 = New Matrix
M1.Rows = 3: M1.Cols = 3
M1.Item(0, 0) = 3 M1.Item(0, 1) = 4 M1.Item(0, 2) = 5 M1.Item(1, 0) = 6 M1.Item(1, 1) = 7 M1.Item(1, 2) = 8 M1.Item(2, 0) = 9 M1.Item(2, 1) = 10 M1.Item(2, 2) = 11
Set M2 = New Matrix M2.Rows = 3: M2.Cols = 1
M2.Item(0, 0) = 1 M2.Item(1, 0) = 1 M2.Item(2, 0) = 1
Set M3 = M1.Times(M2) <---------- Type mismatch error here!
Can you let me know why this doesn't work. More complicated functions such as inverse are working ok and multiplying 3x3 by 3x3 works.
|
|
Posted Wednesday, March 17, 2004 7:44 PM
|
|
|
|
When you use this statement:
Dim M1, M2, M3, M4 As Matrix variables M1,M2,M3 are declared as Variants and only variable M4 is declared as a Matrix variable. Try this:
Dim M1, M2, M3, M4 As Matrix Debug.Print TypeName(M1), TypeName(M4) you will get : Variant Matrix In order to have this problem fixed please replace the Dim statement as follows:
Dim M1 As Matrix, M2 As Matrix, M3 As Matrix, M4 As Matrix
Trifon Triantafillidis | Lead Developer |
|
|
|
|
|