Hello there!
I am trying to make a programm that classifies data , but i don't get the right result.

Here is my code :
Code:
Open "C:\Temp\data1.txt" For Input As #3
Open "C:\Temp\data2.txt" For Output As #4
Dim R(4) As Double

Do While Not EOF(3)
Input #3, R(1), R(2), R(3), R(4)

For k = 1 To 4
If R(k) >= 0 And R(i) <= 10 Then
R(k) = 1
ElseIf R(k) >= 11 And R(k) <= 20 Then
R(k) = 2
ElseIf R(k) >= 21 And R(k) <= 30 Then
R(k) = 3
ElseIf R(k) >= 31 And R(k) <= 40 Then
R(k) = 4
ElseIf R(k) >= 41 And R(k) <= 50 Then
R(k) = 5
End If

Next k
Print #4, R(1), R(2), R(3), R(4)
Loop

Close #4
Close #3
For example i have d1 txt file :
27 32 44 49
4 12 38 22

and the result must be :
3 4 5 5
1 2 4 3

Any suggestion? Thanks anyway