dgaragones
(David G. Aragonés)
May 30, 2021, 3:37pm
1
I have a large file of data with the following structure:
data = {{700., 0.1, 0.2, 0.3}, {800., 10., 30., 40.}, {900., 0.1, 1.4,
15.}};
What I would like is to clean the data, eliminating rows whose maximum value from the 2nd column onwards is less than 1.
In the simplified example I have used before, only the 1st row should be deleted.
Does anyone know how can this be done using Mathematica?
Thanks in advance for any help!
One way might be:
Select[data, Max[#[[2 ;;]]] >= 1 &]
Although Henrik’s suggestion will definitely work, I.e. select the rows that you do want, just for completeness, you may also like to look at DeleteCases. That function allows you to remove the rows you don’t want.
DeleteCases[expr, pattern] removes all elements of expr that match pattern. DeleteCases[expr, pattern, levelspec] removes all parts of expr on levels specified by levelspec that match pattern. DeleteCases[expr, pattern, levelspec, n] removes the...
Cheers
Andy
dgaragones
(David G. Aragonés)
May 31, 2021, 12:13am
4
Thank you very much for your reply!
It is a simple and fast method.