Y
Yankee1423
Say I have a 5 by 5 array. I would like to find the highest value in
each column of that array and also its position. For example in the
following example I'd like to get return the following data:
0, 2, 3, 4, 1
2, 3, 9, 10, 3
3, 4, 6, 7, 8
3, 6, 4, 2, 1
6, 8, 0, 3, 4
6 (5,1)
8 (5,2)
9 (2,3)
10 (2,4)
8 (3,5)
I am able to find the 6, 8, 9, 10, 8 number with a sort function but
can't seem to get the position. Here is the sort function I'm using:
--------------------------------------------------------
Sub Sort(Arr() As Double, first As Integer, last As Integer)
Dim I As Integer
Dim J As Integer
Dim SwapStr As Double
Dim Cont As Double
Dim K As Integer
For K = 1 To 5
For I = first To last - 1
For J = I + 1 To last
If Arr(I, K) > Arr(J, K) Then
SwapStr = Arr(I, K)
Arr(I, K) = Arr(J, K)
Arr(J, K) = SwapStr
End If
Next J
Next I
Next K
each column of that array and also its position. For example in the
following example I'd like to get return the following data:
0, 2, 3, 4, 1
2, 3, 9, 10, 3
3, 4, 6, 7, 8
3, 6, 4, 2, 1
6, 8, 0, 3, 4
6 (5,1)
8 (5,2)
9 (2,3)
10 (2,4)
8 (3,5)
I am able to find the 6, 8, 9, 10, 8 number with a sort function but
can't seem to get the position. Here is the sort function I'm using:
--------------------------------------------------------
Sub Sort(Arr() As Double, first As Integer, last As Integer)
Dim I As Integer
Dim J As Integer
Dim SwapStr As Double
Dim Cont As Double
Dim K As Integer
For K = 1 To 5
For I = first To last - 1
For J = I + 1 To last
If Arr(I, K) > Arr(J, K) Then
SwapStr = Arr(I, K)
Arr(I, K) = Arr(J, K)
Arr(J, K) = SwapStr
End If
Next J
Next I
Next K