You can use the fill
function to construct an array filled with a specific value:
julia> A = fill(5,(6,4))
6x4 Array{Int64,2}:
5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5
julia> A[5,:] = 0
0
julia> A
6x4 Array{Int64,2}:
5 5 5 5
5 5 5 5
5 5 5 5
5 5 5 5
0 0 0 0
5 5 5 5
You also don't need to write 1:end
– you can just write :
for that.