Inverse matrix in VBA, and VBA equiv. for the ":" in Matlab
Inverse matrix in VBA, and VBA equiv. for the ":" in Matlab
(OP)
Hello everyone,
I am looking for an easy way to calculate the inverse of a matrix in VBA. The matrix is 3-D: 3 x 3 x n (with n variable). What I need is the inverse of each "3x3" plane, therefore I would like to use a For/Next loop from 1 to n to do it. I know I could use the following code in Matlab:
Is there a similar way to do this in VBA? What is the VBA equivalent for the ":" in Matlab?
Thanks for your help!
I am looking for an easy way to calculate the inverse of a matrix in VBA. The matrix is 3-D: 3 x 3 x n (with n variable). What I need is the inverse of each "3x3" plane, therefore I would like to use a For/Next loop from 1 to n to do it. I know I could use the following code in Matlab:
CODE -->
for i=1:n A(:,:,i) = inv(B(:,:,i)) end
Is there a similar way to do this in VBA? What is the VBA equivalent for the ":" in Matlab?
Thanks for your help!





RE: Inverse matrix in VBA, and VBA equiv. for the ":" in Matlab
RE: Inverse matrix in VBA, and VBA equiv. for the ":" in Matlab
http://usefulgyaan.wordpress.com/2013/06/12/vba-tr...
for extracting a row or column array from a 2D array, but it won't work on a 3D array.
I'm pretty sure you will need to use a loop.
As noted in the link provided by Noway2, if you want to use Worksheetfunction.Inverse the array will need to be declared as a variant.
Alternatively you could write your own routine to do the inversion, which could work directly on the 3D array.
Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/