VB编程问题,怎么调试,感激不尽!!!
是求5个文件中,各存放有一个相同维数(140 x 720)的二维数据的平均值的!比如3行3列上的数,在5个文件中各不相同,相加除5求得平均值,位置不变,10行200列上的求平均值,等等,运行时出错“输入超出文件尾”。Private Sub Command1_Click()
Dim precipitation_5(140, 720) As Single
Dim precipitation_6(140, 720) As Single
Dim precipitation_7(140, 720) As Single
Dim precipitation_8(140, 720) As Single
Dim precipitation_9(140, 720) As Single
Dim average(140, 720) As Single
Dim i, j
Open App.Path + "\precipitation_5.txt" For Input As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_5(i, j) '读入5月降水数据
Next j
Next i
Close #1
Open App.Path + "\precipitation_6.txt" For Input As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_6(i, j) '读入6月降水数据
Next j
Next i
Close #1
Open App.Path + "\precipitation_7.txt" For Input As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_7(i, j) '读入7月降水数据
Next j
Next i
Close #1
Open App.Path + "\precipitation_8.txt" For Input As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_8(i, j) '读入8月降水数据
Next j
Next i
Close #1
Open App.Path + "\precipitation_9.txt" For Input As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_9(i, j) '读入9月降水数据
Next j
Next i
Close #1
For i = 1 To 140
For j = 1 To 720
average(i, j) = (precipitation_5(i, j) + precipitation_6(i, j) + precipitation_7(i, j) + precipitation_8(i, j) + precipitation_9(i, j)) / 5
Next j
Next i
Open App.Path + "\precipitation.txt" For Output As #1
For i = 1 To 140
For j = 1 To 720
Input #1, precipitation_9(i, j) '输出平均降水数据
Next j
Next i
Close #1
End Sub