|
-
Feb 11th, 2005, 12:20 PM
#1
Thread Starter
New Member
Help !!!
I need to divide one matrix by another like this:
M1 = [ 0.05 0.02
0.07 0.12]
M2 = [1.26 2.35
0.59 5.04]
M3 = M2 / M1
I tried to define M1 and M2 as Val, but the answer is division by zero.
I think when e define M1 as Val all numbers after the dot got lost.
How can i threat textmatrix to become double numbers?
Thanks
-
Feb 11th, 2005, 12:31 PM
#2
Addicted Member
Re: Help !!!
Try like this
Sub main()
Dim M1
Dim M2
Dim M3
M1 = Array(0.05, 0.02, 0.07, 0.12)
M2 = Array(1.26, 2.35, 0.59, 5.04)
For i = 0 To 3
M3 = M2(i) / M1(i)
Debug.Print M3
Next
End Sub
-
Feb 11th, 2005, 01:02 PM
#3
Thread Starter
New Member
Re: Help !!!
Good thiru,
but my array is 2 rows x 2 cols
its a 2x2 matrix
it must give me back a 2x2 matrix !
do you know how?
-
Feb 11th, 2005, 01:30 PM
#4
Addicted Member
Re: Help !!!
This may help you
Sub main()
Dim i, j As Long
Dim MyAr1(2, 2)
Dim MyAr2(2, 2)
MyAr1(1, 1) = 0.125
MyAr2(1, 1) = 0.125
MyAr1(1, 2) = 0.25
MyAr2(1, 2) = 0.5
MyAr1(2, 2) = 0.25
MyAr2(2, 2) = 0.25
MyAr1(2, 1) = 0.625
MyAr2(2, 1) = 0.625
For i = 1 To 2
For j = 1 To 2
Debug.Print MyAr1(i, j) / MyAr2(i, j)
Next
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|