Hello!

I have a 4x4 array of zeros.

julia> X = zeros(4,4)
4x4 Array{Float64,2}:
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0

I have an 2xN array containing indices of elements in X that I want to 
assign a new value.

julia> ind = [1 1; 2 2; 3 3]
3x2 Array{Int64,2}:
 1  1
 2  2
 3  3

What is the simplest way to assign a value to all elements in X whose 
indices are rows in ind? (something like X[ind] = 2.0).

julia> X
 2.0  0.0  0.0  0.0
 0.0  2.0  0.0  0.0
 0.0  0.0  2.0  0.0
 0.0  0.0  0.0  0.0

Reply via email to