How to remove specific rows of an array?

As Matlab person, I thought the below would work, but it doesn’t. So what is the Julia way of doing this simple task?

A = rand(1:10, 12,3);
Ind = A[:,1].<5;
A[Ind, :] = [];

Not sure whether Matlab’s output is the same as when you simply write in Julia: A[.!Ind, :]

2 Likes

Works! Many thanks.

1 Like

A = rand(1:10, 12,3);
A = A[A[:,1] .>= 5,:]

If you just need Ind for indexing into A, then using a view is faster:

A = rand(1:10, 12,3)
Ind = @view(A[:,1]) .< 5
A[.!Ind, :]
2 Likes