this is my first time posting on here :) I am coding a program that will look through various lines and subtract the difference of the time each line was added (each line has a timestamp) and I've successfully converted the timestamps into seconds and added them to the array int32 time(). What I want to do next is make a loop that has the values (82467, 82493, 82518, 82544).(time) Does anyone know how to make a loop that runs through them and gets the difference of for example time(3) - time(2) (then adds this value to the location of an array), next loop does time(2) - time(1)(storing in another location in the array), then time(1) - time(0)(storing that, too). and then calculates the mean values of the stored values? Because when I do my code, which is this loop:
Dim b As Integer = time.Length - 1
While b > 0
DataTextBox.Text += b.ToString
calculation += time(b) - time(b - 1)
MessageBox.Show(calculation)
b -= 1
End While
I get this output: 82467 which is the value of time(0).
Thank you very much in advance, and if I did anything wrong in the way I asked for help, please let me know so I can do it in a better way next time. Thank you!
You could use a For loop
calculation = 0
For b As Integer = time.Length-1 To 1 Step -1
DataTextBox.Text += b.ToString
calculation += time(b) - time(b - 1)
MessageBox.Show(calculation)
Next
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.