Julia: append to an empty vector

Your variable x does not contain an array but a type.

x = Vector{Float64}
typeof(x)  # DataType

You can create an array as Array(Float64, n)
(but beware, it is uninitialized: it contains arbitrary values) or zeros(Float64, n),
where n is the desired size.

Since Float64 is the default, we can leave it out.
Your example becomes:

x = zeros(0)
append!( x, rand(10) )

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)