I have a huge list that looks like this:
list = {8, 12, 201, 0.001, 3, 7, 100
(InterpolatingFunction[{{0., 0.0018}},"<>"][2916/35] +
InterpolatingFunction[{{0., 0.0018}}, "<>"][2916/35]),
23, 44, 11, -0.002}
I want to extract only the numbers, specifically the numbers around 10. I tried using this Select[list, _?(7 <= # <= 13 &)]
but it returns an empty list. I think this happens because the list has both numbers and the 100 (InterpolatingFunction...
that I want to ignore. I would also be happy just to extract ALL numbers hence ignoring the 100(InterpolatingFunction...
elements.
Could you give me some tip please?
Answer
Select
wants a function as second argument, not a pattern. You can either use Cases
or Select
with a pure function:
Cases[list, _?(7 <= # <= 13 &)]
Select[list, (7 <= # <= 13)&]
Comments
Post a Comment