This is an extension of this question.
I have xyPairsAll
, which is a matrix holding sublists. It looks like
{...
{{1., 1812.}, {2., 10076.}, {3., 4764}, {1., 3475.}, {2., 3572.}, {3., 3985.}},
{{1., 6839.}, {2., 3849.}, {3., 2746}, {1., 3578.}, {2., 5629.}, {3., 3849.}},
{{1., 6839.}, {2., 3849.}, {3., 2746}, {1., 10092.}, {2., 1638.}, {3., 3728.}}
...}
I want to split each sublist into 1., 2., 3. sub-sublists based on the first {x, y} pair of each sublist. I don't want to merge any of the sublists; the resulting matrix will gain one more level. It should look like
{...
{{{1., 1812.}, {2., 10076.}, {3., 4764}},
{{1., 3475.}, {2., 3572.}, {3., 3985.}}},
{{{1., 6839.}, {2., 3849.}, {3., 2746}},
{{1., 3578.}, {2., 5629.}, {3., 3849.}}},
{{{1., 6839.}, {2., 3849.}, {3., 2746}},
{{1., 10092.}, {2., 1638.}, {3., 3728.}}}
...}
I can do the split operation on the first sublist with
Split[xyPairsAll[[1]], (First[#2] > First[#1]) &]
How can I repeat the same split operation on all the other sublists too, without merging them?
Split[#, ((First[#2] > First[#1])&)]& /@ xyPairsAll
? $\endgroup$