bsirhell 发表于 2006-11-9 23:24:00

[求助]此函数错在哪?

此函数错在哪?
Function getmaxy(ptarr(), y As Double) As Variant
For i = 0 To UBound(ptarr)
For j = UBound(ptarr) To LBound(ptarr) Step -1
   If ptarr(i)(1) = y And ptarr(j)(1) = y Then
   If ptarr(j)(0) >= ptarr(i)(0) Then
   max = ptarr(j)
   End If
   End If
Next j
Next i
getmaxy = max
End Function
我想实现的是从一个点组中,获得与一个Double类型数值Y相同点,然后找出这些具有相同Y坐标中的最大点
而这个函数找到的点明显不对,是可原因?
页: [1]
查看完整版本: [求助]此函数错在哪?