Let's say that I have an array of some composite type in Julia. I understand that I canβt just assign values ββto an array, since its elements are undefined. For example, the code
type struct u::Int64 v::Int64 end X = Array(struct, 100) X[10].u = 3
generates this error:
ERROR: access to undefined reference in getindex at array.jl:277 in include at boot.jl:238 in include_from_node1 at loading.jl:114
What is the standard way to handle this? At the moment, I'm just doing something like:
samples = Array(Sample1d, num_samples) fill!(samples, Sample1d(0, 0, 0)) samples[i] = ...
Is there a shorter or Julian way to do this?
source share