# How to delete matrix elements where the conditions apply to more than one dimensional element

I have a matrix

m={{10,2},{20,3},{30,4},{40,5},{50,6}}


I can find certain elements with this statement

list=Select[m,(10 < #[[1]] < 50 ) && (#[[2]] < 6) &]


and I get

{20,3},{30,4},{40,5}


How can I use DeleteCases to remove the items {10,2} and {50,6}? I know I can invert the logic on the Select case, but I'd like learn to use DeleteCases, but can't figure out the right syntax for the selection. A one dimensional list is more straight forward, but I'm having trouble generalizing to higher dimensions.

Also, can anyone point me to clear documentation on selection syntax, as I am only mimicing the syntax I see in working examples and that often doesn't work.

Thanks,

DeleteCases[m , _?(Not[10 < #[[1]] < 50 && #[[2]] < 6] &)]


{{20, 3}, {30, 4}, {40, 5}}

It is unclear just what criteria you're seeking. It is easy to "remove the first and last items" by Delete[m, 1] and Delete[m, -1] or

Delete[m, {{1}, {-1}}].


What mathematical criteria do you wish to invoke?

• What you offer is also useful, but I was looking for deleting certain elements which meet certain criteria. The fact that the selected items were the 1st and last items was just a coincidence. I will modify my original question Apr 13, 2017 at 21:06