broadcast_setindex!
broadcast_setindex!(A, X, inds...)
Broadcasts the X
and inds
arrays to a common size and stores the value from each position in X
at the indices given by the same positions in inds
.
Examples
julia> foo = [1 2];
julia> bar = [2; 1];
julia> baz = [8 9; 10 11];
julia> A = Array(Int64, 2, 2);
julia> broadcast_setindex!(A, baz, foo, bar)
2x2 Array{Int64,2}:
10 8
11 9
julia> # foo -> [1 2; 1 2]; bar -> [2 2; 1 1];
julia> # baz[1,1] stored in A[foo[1], bar[1]] and so on
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.