bbkcylh 发表于 2016-4-27 06:12
是所有点的的最大X、Y值么
对,就是求出X和Y的最大最小值,这是我的代码,不对的地方,希望帮忙改正,谢谢- Dim L As Integer
- Dim H(10000) As Double, X(10000) As Double, Y(10000) As Double, Z(10000) As Double
- Dim Xmax As Double, Xmin As Double, Ymax As Double, Ymin As Double
- Sub txt_read()
- Dim txtname As String
- Dim L As Integer
- L = 0 '初始值
- Open "E:\demdata.txt" For Input As #1 '打开文件
- Do While Not EOF(1) '文件读取循环
- If X(L + 1) > X(L) Then
- Xmax = X(L + 1)
- ElseIf Y(L + 1) > Y(L) Then
- Ymax = Y(L + 1)
- Else
- Xmin = X(L + 1)
- Ymin = Y(L + 1)
- End If
- L = L + 1 '个数加1
- Input #1, H(L), X(L), Y(L), Z(L) '读取文件数据, H贮存点序号,XYZ为坐标
- Loop '文件读取循环
- Close #1 '关闭文件
- End Sub
|