我试图将数据从2个双数组移动到2个不同的双数组.我不确定大小是多少,因为我从第一个数组中取出一个随机样本并将其放入第二个数组中.
当我添加ReDim Preserve行时,我得到下标超出范围错误.
Function CreateTrainingSet(TrainingPercent As Double, Inputs() As Double, Outputs() As Double)
' Create Randomized Training set data
Dim TrainingInputs() As Double, TrainingOutputs() As Double
Dim i As Integer, j As Integer, count As Integer
'ReDim TrainingInputs(UBound(Inputs, 1), UBound(Inputs, 2))
'ReDim TrainingOutputs(UBound(Outputs, 1), UBound(Outputs, 2))
count = 0
' Move TraningPercent % of data from Inputs and Outputs to TrainingInputs and TrainingOutputs
For i = LBound(Inputs, 1) To UBound(Inputs, 1)
Dim ran As Double
ran = Rnd()
If ran …Run Code Online (Sandbox Code Playgroud)