Hey, I’m new to Julia and not sure about some issues regarding arrays. One of these is this one:
I just want to bind several vectors with zeros to an array. Their length is given in another array like that:
length = [10 20 30 40....]
Now I do the following:
zeroarray = zeros(length[1])
zeroarray = vcat([zeroarray], zeros(length[2])
for i in 3:length(length)
zeroarray = vcat(zeroarray, zeros(length[i])
end
This looks not like the appropriate approach to me. I would like to know how to formulate this properly. For explanation, this is the equivalent in python:
import numpy as np
length = [10, 20, 30, 40,....]
zeroarray = [np.zeros(length[0])]
for i in range(1, len(length)):
zeroarray.append(np.zeros(length[i]))
Oh yeah, that does work indeed! I completely forgot about the possibility of using zeros.() . And yes, I want to write it with commas .
Thank you very much!