Accessing 2D array/matrix values with Booleans

Make p and boolRand vectors instead of matrices and it will work.


julia>  p=[0.2, 0.4 , 0.3]
3-element Array{Float64,1}:
 0.2
 0.4
 0.3

julia> booleRand=rand(3).>p
3-element BitArray{1}:
 true
 true
 true

julia> A[:, booleRand]
3×3 Array{Int64,2}:
 1  2  3
 4  5  6
 7  8  9