You’re trying to access an empty array at index 1.
Actually I want to push elements in the new array
Then you should use
Unlike Matlab, you need to use
push! — Julia won’t automatically grow arrays by assigning to them out-of-bounds.