Posted Monday, March 01, 2004 4:50 PM
|
|
|
|
Hi,
I am having trouble with using the eigen method
I get an 'type mismatch (13)' error no matter how I try to using it. The code below does not work and gives the error I have mentioned.
Sub genvalues(Sheet, FX, FY) Set M = CreateObject("BluebitMatrix30.Matrix") M.Size 3, 3
For X = 0 To 2 For Y = 0 To 2 M(X, Y) = Worksheets(Sheet).Cells(Y + FY, X + FX) Next Next
Set RoE = CreateObject("BluebitMatrix30.Matrix") Set IoE = CreateObject("BluebitMatrix30.Matrix") Set RoV = CreateObject("BluebitMatrix30.Matrix") Set IoV = CreateObject("BluebitMatrix30.Matrix")
M.EigenC RoE, IoE, RoV, IoV .... End Sub
I have also tried not declaring the variables.
Can you tell me what I am doing wrong.
Thanks in advance
|
|
Posted Monday, March 01, 2004 4:56 PM
|
|
|
|
Hi
The reason for this 'type mismatch' error is that Eigen method expects to find as parameters Matrix object variables.
The variables that you are using (RoE, IoE, RoV, IoV) have not been declared as Matrix variables so they are Variants by default. Those variants contain references to Matrix objects.
A Variant variable containing a reference to a Matrix object is not the same as a Matrix variable.
To solve this problem please modify your code as follows:
Sub genvalues(Sheet, FX, FY) Dim M As Matrix, RoE As Matrix, IoE As Matrix Dim RoV As Matrix, IoV As Matrix
' CreateObject is fine but you can also use: ' Set M = New BluebitMatrix30.Matrix ' or ' Set M = New Matrix Set M = CreateObject("BluebitMatrix30.Matrix") M.Size 3, 3
For X = 0 To 2 For Y = 0 To 2 M(X, Y) = Worksheets(Sheet).Cells(Y + FY, X + FX) Next Next
Set RoE = CreateObject("BluebitMatrix30.Matrix") Set IoE = CreateObject("BluebitMatrix30.Matrix") Set RoV = CreateObject("BluebitMatrix30.Matrix") Set IoV = CreateObject("BluebitMatrix30.Matrix")
M.EigenC RoE, IoE, RoV, IoV .... End Sub
Trifon Triantafillidis | Lead Developer |
|
|
|
|
|