Manipulate a list in math with select

I imported some data into Mathematica. The data will be similar to

{{0,2},{2,3},{4,3},{5,4},{8,4}}

I want to throw out all elements for which x values ​​are less than the given value, or create a new list containing data for which x values ​​are greater than this value. I guess Select should do the job, but I don't know how to do it.

Thanks in advance for your help.

+3
source share
2 answers

What about

 data = {{0,2},{2,3},{4,3},{5,4},{8,4}};
 filtered = Select[data, First[#]>3&];

where do you replace 3 with your value?

+5
source

Another universal approach is to use Cases and attach a condition (/;)

For instance:

data = {{0, 2}, {2, 3}, {4, 3}, {5, 4}, {8, 4}}; Cases [data, {x_, y _} /; x> 3]

():

[, {x_/; x > 3, _}]

( DeleteCases)

+3

Source: https://habr.com/ru/post/1773508/


All Articles