Hey, I'm pretty new to Mathematica and am still learning, but I've struck upon a problem on how to do something. No amount of reading forums or language documentation has seemed to have helped, so please could someone help me out.
So I have data from an experiment in which the data follows this general trend of the simulated data (for simplicity) below.
data = {{4, 1.2}, {3, 15.4}, {2, 6.6}, {1, 19.5}, {0, 5.5}, {-1,
1.8}, {-2, 11.1}, {-1, 6.3}, {0, 3.5}, {1, 15.3}, {2, 11.1}, {1,
4.1}, {0, 14.9}, {-1, 2.4}, {-2, 10.1}, {-3, 7.3}, {-4,
10.8}, {-3, 7.2}, {-2, 10.9}, {-1, 9.6}, {0, 17.3}, {1, 4.4}, {2,
10.0}, {3, 9.8}, {4, 0.4}, {3, 15.2}, {2, 14.5}, {1, 11.8}, {0,
3.1}, {-1, 19.6}, {0, 1.9}, {1, 14.1}, {2, 17.8}, {3, 8.60}, {4,
0.559}, {5, 13.0}, {6, 10.6}};
What I want to do with this data is yo be able to split the data into a new row at the point within the row value data[[All,1] ]. The point I want to do that at is when data[[All,1] ] goes from increasing to decreasing, so when x<y>z, if that makes sense?
To elaborate, if you used the sample data set above, the desired output of the script I want would be:
{{{4, 1.2}, {3, 15.4}, {2, 6.6}, {1, 19.5}, {0, 5.5}, {-1, 1.8}, {-2,
11.1}, {-1, 6.3}, {0, 3.5}, {1, 15.3}}, {{2, 11.1}, {1, 4.1}, {0,
14.9}, {-1, 2.4}, {-2, 10.1}, {-3, 7.3}, {-4, 10.8}, {-3,
7.2}, {-2, 10.9}, {-1, 9.6}, {0, 17.3}, {1, 4.4}, {2, 10.0}, {3,
9.8}}, {{4, 0.4}, {3, 15.2}, {2, 14.5}, {1, 11.8}, {0, 3.1}, {-1,
19.6}, {0, 1.9}, {1, 14.1}, {2, 17.8}, {3, 8.60}, {4, 0.559}, {5,
13.0}, {6, 10.6}}};
So that actual data I'm using is a much larger data set, and I want to be able to spit the data automatically into separate rows in this way so I can plot the new split data individually, to allow me to just plot specific sets of the data.
I've been trying to solve how to write this script to work for a couple of days now and it's honestly driving me insane. Any help on how you would go about doing this would be SO appreciated.