挑毛病(数组)
Public Sub Conang(Cdz_X() As Single, Cdz_y() As Single, Cdz_h() As Single, ss() As Variant)Dim gg As Integer, jj As Integer, m As Integer, n As Integer
Dim Csdz_X() As Single
Dim Csdz_y() As Single
Dim Csdz_h() As Single
Dim Rs() As Long
Dim s As Long
s = 0
n = 0
If UBound(ss) = 0 Then Exit Sub
For gg = 1 To UBound(ss)
ReDim Preserve Rs(gg)
Erase Csdz_X()
Erase Csdz_y()
Erase Csdz_h()
If gg = 1 Then
m = 0
Else
m = Rs(gg - 1)
End If
For jj = m To ss(gg)
ReDim Preserve Csdz_X(n)
ReDim Preserve Csdz_y(n)
ReDim Preserve Csdz_h(n)
Csdz_X(n) = Cdz_X(jj)
Csdz_y(n) = Cdz_y(jj)
Csdz_h(n) = Cdz_h(jj)
n = n + 1
Next
If gg = 1 Then
Rs(gg) = ss(gg - 1)
Else
Rs(gg) = m + ss(gg) - ss(gg - 1)
End If
Comang s, Csdz_X(), Csdz_y(), Csdz_h()'输出
s = s + 1
Next gg
End Sub
可以正常运行,但从第二个循环开始有重复的数据,为何?
[ 本帖最后由 lzx1556 于 2014-6-18 20:06 编辑 ]