Ramesh Kadambi
Ramesh Kadambi

Reputation: 536

Julia : Multidimensional Array indexing by a predicate

I have a multidimensional array 69 x 4 in JULIA. I would like to filter the rows using a condition on one of the columns of the frame.

updown[updown[:,4] .> .5]

does not seem to work.

Upvotes: 2

Views: 168

Answers (1)

DSM
DSM

Reputation: 352959

You could pass something for the second axis, basically saying "all columns":

julia> updown = randn(69, 4);

julia> updown[updown[:, 4] .> 1.5, :]
4×4 Array{Float64,2}:
  1.76637    -0.307257  -0.125816  1.89179
  0.0858598  -0.812886  -0.030113  1.66113
 -0.144546    0.374371  -0.731996  1.56694
  0.330211    0.108665   0.98783   1.71425

Upvotes: 4

Related Questions