I am using Mathematica version 9.0 and am trying to compare and remove x-coordinates, and the associated y-coordinate, that are less than previous x-coordinates. Below is an example using sample data.
Raw data:
{{611.011, 1008}, {611.062, 1077}, {611.114, 1193}, {610.958, 894}, {611.009, 1621},
{611.061, -166}, {611.112, 704}, {611.164, 131}, {611.215, 1306}, {692.637, 6394},
{692.688, 6369}, {692.739, 6664}, {692.328, 6790}, {692.379, 7378}, {692.431, 5761},
{692.482, 6750}, {692.533, 6348}, {692.584, 7535}, {692.635, 7365}, {692.686, 7725},
{692.737, 7553}, {692.788, 8649}, {692.839, 8649}, {692.89, 7553}}
Desired outcome:
{{611.011, 1008}, {611.062, 1077}, {611.114, 1193}, {611.164, 131}, {611.215, 1306},
{692.637, 6394}, {692.688, 6369}, {692.739, 6664}, {692.839, 8649}, {692.89, 7553}}
I tried using the suggestion from the answer to the question below, but could not get the code to work properly.
Cases[rawdata, {Alternatives @@ FoldList[Max, rawdata[[All, 1]]], _}]
$\endgroup$Union
(Alternatives @@ Union@FoldList[Max, rawdata[[All, 1]]]
) - this will speed things up, since duplicate alternatives need not be checked. $\endgroup$