Here is my list. The first column contains its index and second column has data.
list={{1, 170.93}, {2, 170.4}, {3, 174.08}, {4, 160.65}, {5, 166.44}, {6,
169.75}, {7, 175.86}, {8, 177.6}, {9, 180.27}, {10, 182.82}, {11,
182.02}, {12, 186.65}, {13, 184.53}, {14, 186.17}, {15,
177.29}, {16, 172.06}, {17, 175.58}, {18, 168.09}, {19,
172.33}, {20, 165.1}, {21, 154.88}, {22, 161.28}, {23, 165.25}, {24,
165.15}, {25, 171.03}, {26, 174.55}, {27, 182.57}, {28,
191.02}, {29, 191.11}, {30, 184.93}, {31, 188.85}, {32, 191.44}};
I want to delete all numbers that are smaller than the last largest element. For example, I want to delete 4th, 5th and 6th elements because they are smaller than the last largest element (3rd). Similarly, I want to delete elements from 13th to 27th elements because they are smaller than the last largest element (12th). 30th and 31st elements should be deleted because they are smaller than prior largest element (29th). Final results should contain increasing numbers. Here is the tabular representation of the data:
I did my best to explain my problem. Please write in the comment if it is not clear. I have a big data and I need to manipulate it as explained here. Any help would be greatly appreciated. Thanks
DeleteDuplicatesBy[ Transpose[{list[[All, 1]], FoldList[Max, list[[All, 2]]]}], Last]
should do what you're after. $\endgroup$DeleteDuplicates[list, #1[[2]] > #2[[2]] &]
$\endgroup$