Array of multiple differently sized vectors

undef is not a value, it means that you are just grabbing arbitrary memory (“random” values), which is almost certainly not what you want for your missing data.

If you have an array V of vectors, and you want to copy to a 2d array A with missing data taken up by NaN, you could do something like:

A = fill(NaN, m, n)
copyto!.(eachcol(A), V) # to copy to the columns
copyto!.(eachrow(A), V) # to copy to the rows

(Of course, you could also just write a loop. Loops are fine in Julia.)

6 Likes