0

For example, say I have a set of data which takes the form

list = {{1,2,4,5,3,2},{2,3,4,2,1,6},{2,3,4,5,4,3}}  

where all of the elements have a length of 6. Then I have to run this list through many functions each with various restrictions e.g.:

ptOf[event_]:=px+py/;(px+py)<4, 

where px is the first element in the 6 vector {px,py,_,_,_,_} and py is the second element.

How would I cut the elements from the original list that do not satisfy this condition?

Öskå
  • 8,587
  • 4
  • 30
  • 49
user16104
  • 17
  • 2

1 Answers1

1

For this special case you need to use Select and Part a.k.a. [[]]:

list = {{1,2,4,5,3,2},{2,3,4,2,1,6},{2,3,4,5,4,3}}  
Select[list, #[[1]] + #[[2]] < 4 &]
{{1, 2, 4, 5, 3, 2}}
Öskå
  • 8,587
  • 4
  • 30
  • 49