Adds another matrix to the current matrix.
MatrixObject.PlusEquals MatrixToAdd
Both matrices must be of the same size (Rows and Cols properties must be equal).
Unlike the Plus Method, PlusEquals does not create a new matrix but instead adds to current matrix elements.
Error 1312 will be returned if the matrices are not of the same size.
Private Sub MatrixPlusMinusEquals()
Dim A As Matrix, B As Matrix
Set A = New Matrix
A.Size 5, 5
A.FillRandom
Debug.Print "A ="
Debug.Print A.GetString(0)
Set B = New Matrix
B.Size 5, 5
B.FillRandom
Debug.Print "B ="
Debug.Print B.GetString(0)
A.PlusEquals B
Debug.Print "A + B = "
Debug.Print A.GetString(0)
A.MinusEquals B
Debug.Print "A - B = "
Debug.Print A.GetString(0)
End Sub
A = | 6 2 8 6 5 | | 4 9 8 7 2 | | 9 7 5 3 0 | | 1 4 1 2 10 | | 4 1 0 0 4 | B = | 6 6 6 2 7 | | 5 4 1 6 8 | | 8 5 3 9 7 | | 10 9 5 1 5 | | 2 9 2 8 8 | A + B = | 12 8 14 8 12 | | 9 13 9 13 10 | | 17 12 8 12 7 | | 11 13 6 3 15 | | 6 10 2 8 12 | A - B = | 6 2 8 6 5 | | 4 9 8 7 2 | | 9 7 5 3 0 | | 1 4 1 2 10 | | 4 1 0 0 4 |