I am trying to convert a lower diagonal matrix to a symmetric matrix using the following simple function. It works great for matrix of size 60X60 for sure, I tried using it for 120X120 matrix and it failed.
Is there something I am doing wrong!
Here is the function code!
Function fullmatrix(matrix) As Variant
Set therange = matrix
nrows = matrix.Rows.Count
ReDim matrix(1 To nrows, 1 To nrows) As Double
Dim outp1() As Double
ReDim outp1(1 To nrows, 1 To nrows)
For i = 1 To nrows
For j = 1 To i
outp1(i, j) = therange.Cells(i, j)
Next
Next
For j = 1 To nrows
For i = j + 1 To nrows
outp1(j, i) = outp1(i, j)
Next
Next
End If
fullmatrix = outp1()
End Function
Is there something I am doing wrong!
Here is the function code!
Function fullmatrix(matrix) As Variant
Set therange = matrix
nrows = matrix.Rows.Count
ReDim matrix(1 To nrows, 1 To nrows) As Double
Dim outp1() As Double
ReDim outp1(1 To nrows, 1 To nrows)
For i = 1 To nrows
For j = 1 To i
outp1(i, j) = therange.Cells(i, j)
Next
Next
For j = 1 To nrows
For i = j + 1 To nrows
outp1(j, i) = outp1(i, j)
Next
Next
End If
fullmatrix = outp1()
End Function