I have a matrix m
m={{10,2},{20,3},{30,4},{40,5},{50,6}}
I also have a list n
list1={1,2,3,4,5}
and another matrix
p={{25,-23},{64,33},{77,74},{99,5},{200,68}}
I can find certain elements in matrix m with this statement
list2=Select[m,(10 < #[[1]] < 50 ) && (#[[2]] < 6) &]
and I get
{20,3},{30,4},{40,5}
I can also use
list2=DeleteCases[m , _?(10 < #[[1]] < 50 && #[[2]] < 6 &)];
Now, how can I get the position of those deleted items (or selected items) so I can use that information to trim down both the list1 and other matrix p to yield
{2,3,4}
and from matrix p
p={{64,33},{77,74},{99,5}}
I've tried to obtain position information about the deleted items using:
list3 = Position[m, _?(10 < #[[1]] < 50) && (#[[2]] < 6) &]
and
list3 = Position[m, (10 < #[[1]] < 50) && (#[[2]] < 6) &]
but I'm getting empty set all the time.
Thanks,
Position[m, _?((10 < #[[1]] < 50) && (#[[2]] < 6) &)]
instead. Looking into why this gives messages. $\endgroup$