Re: [julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread John Myles White
I think this will be work: julia r = ones(5, 5) 5x5 Array{Float64,2}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia pos = [3, 4] 2-element Array{Int64,1}: 3 4 julia r[pos...] 1.0 — John On Feb 17, 2014, at

Re: [julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread Stefan Karpinski
r[pos...] will do it. On Mon, Feb 17, 2014 at 7:58 PM, David P. Sanders dpsand...@gmail.comwrote: El lunes, 17 de febrero de 2014 18:57:10 UTC-6, David P. Sanders escribió: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4]

[julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread Patrick O'Leary
On Monday, February 17, 2014 6:57:10 PM UTC-6, David P. Sanders wrote: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have the position [3, 4] stored in a variable as pos = [3, 4] How can I use pos as

[julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread David P. Sanders
El lunes, 17 de febrero de 2014 18:57:10 UTC-6, David P. Sanders escribió: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have the position [3, 4] stored in a variable as pos = [3, 4] How can I use

[julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread David P. Sanders
El lunes, 17 de febrero de 2014 19:03:55 UTC-6, Patrick O'Leary escribió: On Monday, February 17, 2014 6:57:10 PM UTC-6, David P. Sanders wrote: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have the