Conditional array indexing is a really nice convenience when one wants to access array items that fullfills a certain boolean criteria. This is done in Julia in the following way:
julia> probs = [0.1, 0.2, 0.3, 0.4, 0.5]
5-element Array{Float64,1}:
0.1
0.2
0.3
0.4
0.5
julia> probs[probs.>0.2]
3-element Array{Float64,1}:
0.3
0.4
0.5
Observe the “.” in the .> operator which signifies elemetwise comparison.
If you omit the “.” you will get the following error:
probs[probs>0.2]
ERROR: no method isless(Float64,Array{Float64,1})
in > at operators.jl:19