Attribute VB_Name = "modMethod"
'频数和累积频数的计算方法
Option Explicit
'P(1 To 行数,1 To 列数):原始数据
'R(1 To 3,1 To 分段数):
' R(1,...)保存段值;R(2,...)保存频数;R(3,...)保存累积频数
Public Sub Fre_Add(P, R)
Dim I As Integer, J As Integer, L As Integer
Dim M As Integer, N As Integer, Z As Integer
'根据数组求下标的上界
'M是数据的行数
'N是数据的列数
'Z是数据的分段数
M = UBound(P, 1): N = UBound(P, 2): Z = UBound(R, 2)
'计算频数
For I = 1 To M
For J = 1 To N
For L = 1 To Z
If P(I, J) '落入区间范围
R(2, L) = R(2, L) + 1
GoTo 100
End If
Next L
100: Next J
Next I
'计算累积频数
For L = 1 To Z
R(3, L) = R(2, L)
Next L
For L = 2 To Z
R(3, L) = R(3, L) + R(3, L - 1)
Next L
End Sub