Iβm trying to understand how to initiate multiple arrays from a set of names. To initiate a new vector I would do something like
j = Vector{Float64}(undef,10)
typeof(j)
Vector{Float64} (alias for Array{Float64, 1})
but suppose I want to initiate multiple vectors with a set of names.
entries = ("a", "b","c")
something like
[x = Vector{Float64}(undef,10) for x in entries]
creates the vectors but does not assign them to the variables in entries.
3-element Vector{Vector{Float64}}:
[0.0, 6.52171459e-315, 5.43316358e-314, 0.0, 1.5e-323, 5.43316358e-314, 2.0e-323, 1.0e-323, 5.43316358e-314, 3.5e-323]
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.52171459e-315]
[1.0e-323, 5.43316358e-314, 5.0e-323, 3.0e-323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
but then
typeof(b)
ERROR: UndefVarError: b not defined
likewise
[x => Vector{Float64}(undef,10) for x in entries]
3-element Vector{Pair{String, Vector{Float64}}}:
"a" => [5.4e-323, 3.0e-323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
"b" => [2.0e-323, 5.433169509e-314, 2.5e-323, 1.0e-323, 5.433169509e-314, 4.0e-323, 1.0e-323, 5.433169509e-314, 5.4e-323, 3.0e-323]
"c" => [0.0, 0.0, 0.0, 0.0, 0.0, 6.52171459e-315, 5.433169509e-314, 0.0, 2.0e-323, 5.433169509e-314]
Returns the same UndefVarError
when the variables are called. I know I am missing something elementary here because the behavior is consistent when I try mapping.
map(x-> Vector{Float64}(undef,10),ent)
Thanks for your patience! Any pointers would be greatly appreciated!