Question: Filtering a Matrix

Hello.

I need to filter a 2D Matrix based on the values in one of its columns.

Let's have a 2D Matrix like this one:

[1, 2]
[-2, 3]
[3, 18]

Now let's suppose we want to remove all rows with a negative number in the first column (second row in our example).

One possible solution would be to iterate over the whole Matrix in a for-loop removing rows one-by-one, but I was hoping for something more elegant (and hopefully faster).

I've been playing with select, SearchArray and DeleteRow, however it's hard to believe there is not an out-of-the-box function for this...

 

Many thanks.

Please Wait...