# How to remove specific rows of an array?

**URL:** <https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948>\
**Category:** General Usage\
**Tags:** question, arrays\
**Created:** [October 17, 2021, 9:41pm UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948 "2021-10-17T21:41:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 17, 2021, 9:41pm UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948/1 "2021-10-17T21:41:39Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 17, 2021, 10:09pm UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948/2 "2021-10-17T22:09:15Z")

</div>

> [@leon](#):
>
> ```julia
> 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, :]`

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 17, 2021, 10:18pm UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948/3 "2021-10-17T22:18:05Z")

</div>

Works! Many thanks.

---

<div class="post-metadata">

**Author:** ![abobroff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abobroff/32/3752_2.png) [@abobroff](https://discourse.julialang.org/u/abobroff)\
**Post date:** [October 18, 2021, 5:36am UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948/4 "2021-10-18T05:36:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [October 18, 2021, 7:47am UTC](https://discourse.julialang.org/t/how-to-remove-specific-rows-of-an-array/69948/5 "2021-10-18T07:47:53Z")

</div>

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

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

```
