Good evening,
I can't figure out how to solve the following problem.
Assuming that I have a dataset as in the picture, I would like to divide it into many smaller datasets using the variable "State" and keeping the sequence. Actually the real dataset has more than 200000 observations so I can't know when the variable State changes from NORMAL to RECOVERY and vice versa, but I would like to split the dataset into many mini sequences where each one has the same State variable for all the observations.
Then, I would need to divide the variables into a Predictors set (varaibles Sensor 1, Sensor 2, Sensor 3) and a Response set (variable State).
If we take, as an example, the image, at the end of the problem I would like to have for the Predictors a cell array of size Nx1 (N equal to the number of mini sequences) with the first cell of size 3×2 (the three features and the first two observations), the second cell of size 3×2, the third cell of size 3×1 and so on. Correspondingly, for the Response I would like to have an Nx1 cell array where the first cell is of dimension 1×2, the second is 1×2, the third is 1×1 and so on.
The problem is that with a dataset of 200000 observations I don't know what kind of loop to use and how to use it.
Thank you!
Best Answer