[julia-users] Re: subsetting an array with 2 or more criteria

2014-05-20 Thread Ivar Nesje
Try to add parentheses *A[(A.>0.5)&(A.<0.9)]* The expressions you posted reads A[ A .> (0.5&A) .< 0.9] There is an open issue about the high precedence of & Ivar kl. 15:38:08 UTC+2 tirsdag 20. mai 2014 skrev Florian Oswald følgende: > > I have an array A that i want to subset, as in > > A = ra

[julia-users] Re: subsetting an array with 2 or more criteria

2014-05-20 Thread Ivar Nesje
See: https://github.com/JuliaLang/julia/issues/5187 kl. 15:45:43 UTC+2 tirsdag 20. mai 2014 skrev Ivar Nesje følgende: > > Try to add parentheses > > *A[(A.>0.5)&(A.<0.9)]* > The expressions you posted reads > A[ A .> (0.5&A) .< 0.9] > > There is an open issue about the high precedence of & > > I

[julia-users] Re: subsetting an array with 2 or more criteria

2014-05-20 Thread Michael Hatherly
As another option you could use chained comparisons in this case (I think that's what they're called). A[0.5 .< A .< 0.9] On Tuesday, 20 May 2014 15:38:08 UTC+2, Florian Oswald wrote: > > I have an array A that i want to subset, as in > > A = rand(100,100) > A[A.>0.5] > > I'm struggling to find