If would contemplate just push each new vector into a vector of vectors.
allArrays = Vector{Float64}[] ## 0-element Vector{Vector{Float64}}
for i in 1:j
start_index = trunc(Int, idx_en11[:,i][1])
stop_index = trunc(Int, idx_en12[:,i][1]).-1
myArray = avg[start_index:stop_index]
push!(allArrays, myArray)
end
Here a demo of those mechanics:
julia> allArrays = Vector{Float64}[]
Vector{Float64}[]
julia> push!(allArrays, rand(447))
1-element Vector{Vector{Float64}}:
[0.5553100384709726, 0.14329276653838385, 0.2122371540922311, 0.19173683594235424, 0.6721354076745469, 0.6338905566453745, 0.21436969177264487, 0.6177553797319678, 0.19714812767752599, 0.6355347292448187 … 0.8901893528103014, 0.3466308206560611, 0.6672522121273377, 0.5466765076644736, 0.507350924539655, 0.972234282646458, 0.6049229046377905, 0.8010342902465192, 0.9842372301506985, 0.9268759753477283]
julia> push!(allArrays, rand(558))
2-element Vector{Vector{Float64}}:
[0.5553100384709726, 0.14329276653838385, 0.2122371540922311, 0.19173683594235424, 0.6721354076745469, 0.6338905566453745, 0.21436969177264487, 0.6177553797319678, 0.19714812767752599, 0.6355347292448187 … 0.8901893528103014, 0.3466308206560611, 0.6672522121273377, 0.5466765076644736, 0.507350924539655, 0.972234282646458, 0.6049229046377905, 0.8010342902465192, 0.9842372301506985, 0.9268759753477283]
[0.3948109027175797, 0.17318306720945775, 0.10221023595881262, 0.9718289233265024, 0.10302272546278368, 0.07161687819824236, 0.5311699483090109, 0.7489144436217869, 0.3962305676607649, 0.774907278037163 … 0.8169160812295143, 0.5272617486552499, 0.13392091736481082, 0.5307152194931672, 0.7172582090369259, 0.9004315541474207, 0.12043996279926983, 0.9667534635773031, 0.2982939926425868, 0.6200865956828158]
julia> push!(allArrays, rand(10))
3-element Vector{Vector{Float64}}:
[0.5553100384709726, 0.14329276653838385, 0.2122371540922311, 0.19173683594235424, 0.6721354076745469, 0.6338905566453745, 0.21436969177264487, 0.6177553797319678, 0.19714812767752599, 0.6355347292448187 … 0.8901893528103014, 0.3466308206560611, 0.6672522121273377, 0.5466765076644736, 0.507350924539655, 0.972234282646458, 0.6049229046377905, 0.8010342902465192, 0.9842372301506985, 0.9268759753477283]
[0.3948109027175797, 0.17318306720945775, 0.10221023595881262, 0.9718289233265024, 0.10302272546278368, 0.07161687819824236, 0.5311699483090109, 0.7489144436217869, 0.3962305676607649, 0.774907278037163 … 0.8169160812295143, 0.5272617486552499, 0.13392091736481082, 0.5307152194931672, 0.7172582090369259, 0.9004315541474207, 0.12043996279926983, 0.9667534635773031, 0.2982939926425868, 0.6200865956828158]
[0.9697403100437177, 0.9100866635975313, 0.1480070250228125, 0.004596600503084303, 0.5184083549582552, 0.6072774948973072, 0.46150602234938054, 0.5946353696886346, 0.9346405608456394, 0.463381683256588]
julia> allArrays
3-element Vector{Vector{Float64}}:
[0.5553100384709726, 0.14329276653838385, 0.2122371540922311, 0.19173683594235424, 0.6721354076745469, 0.6338905566453745, 0.21436969177264487, 0.6177553797319678, 0.19714812767752599, 0.6355347292448187 … 0.8901893528103014, 0.3466308206560611, 0.6672522121273377, 0.5466765076644736, 0.507350924539655, 0.972234282646458, 0.6049229046377905, 0.8010342902465192, 0.9842372301506985, 0.9268759753477283]
[0.3948109027175797, 0.17318306720945775, 0.10221023595881262, 0.9718289233265024, 0.10302272546278368, 0.07161687819824236, 0.5311699483090109, 0.7489144436217869, 0.3962305676607649, 0.774907278037163 … 0.8169160812295143, 0.5272617486552499, 0.13392091736481082, 0.5307152194931672, 0.7172582090369259, 0.9004315541474207, 0.12043996279926983, 0.9667534635773031, 0.2982939926425868, 0.6200865956828158]
[0.9697403100437177, 0.9100866635975313, 0.1480070250228125, 0.004596600503084303, 0.5184083549582552, 0.6072774948973072, 0.46150602234938054, 0.5946353696886346, 0.9346405608456394, 0.463381683256588]
julia> allArrays[1]
447-element Vector{Float64}:
0.5553100384709726
0.14329276653838385
0.2122371540922311
0.19173683594235424
0.6721354076745469
0.6338905566453745
0.21436969177264487
0.6177553797319678
0.19714812767752599
0.6355347292448187
⋮
0.3466308206560611
0.6672522121273377
0.5466765076644736
0.507350924539655
0.972234282646458
0.6049229046377905
0.8010342902465192
0.9842372301506985
0.9268759753477283
julia> allArrays[2]
558-element Vector{Float64}:
0.3948109027175797
0.17318306720945775
0.10221023595881262
0.9718289233265024
0.10302272546278368
0.07161687819824236
0.5311699483090109
0.7489144436217869
0.3962305676607649
0.774907278037163
⋮
0.5272617486552499
0.13392091736481082
0.5307152194931672
0.7172582090369259
0.9004315541474207
0.12043996279926983
0.9667534635773031
0.2982939926425868
0.6200865956828158
julia> allArrays[3]
10-element Vector{Float64}:
0.9697403100437177
0.9100866635975313
0.1480070250228125
0.004596600503084303
0.5184083549582552
0.6072774948973072
0.46150602234938054
0.5946353696886346
0.9346405608456394
0.463381683256588