PDA

View Full Version : WorksheetFunction.MInverse Method



Rasm
12-06-2011, 02:12 AM
I am inverting a matrix - but it seems that it only works if my first element is XTX(1,1) - in other words Option Base 1 - can anybody confirm if that is true or not. Below is my code - in order to get it working - I had to make the array XTX start with element 1 - if I use option base zero it generates an error. I know the simple answer is to just use option base 1 - however all my other arrays are zero based. So what a mess if arrays are different starting point.

I am starting to think that I should use option base 1 - period - it seems Excel sometimes support both - but always support option base 1.




For XX = 0 To NumVal - 1
For XXX = 0 To NumVal - 1
InvXTX(XX, XXX) = Application.Index((Application.MInverse(XTX)), XX + 1, XXX + 1)
Next XXX
Next XX

Admin
12-06-2011, 07:55 AM
Split and Filter will return a zero based array irrespective of Option base statement. Otherwise as my thinking is that you have to write Option base statement to declare the default lower bound for array subscripts.