Finding Position of Element in an Array

You can convert, something like

julia> v = rand(3,3);

julia> C = findall(x->x>0.5, v)
5-element Array{CartesianIndex{2},1}:
 CartesianIndex(2, 1)
 CartesianIndex(2, 2)
 CartesianIndex(3, 2)
 CartesianIndex(2, 3)
 CartesianIndex(3, 3)

julia> L = LinearIndices(v)
3×3 LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}:
 1  4  7
 2  5  8
 3  6  9

julia> L[C]
5-element Array{Int64,1}:
 2
 5
 6
 8
 9
1 Like