Y'all,
sorry if the question doesn't fully capture the actual problem, I simply don't know how to exactly describe it in a concise manner. This is the problem: I have a matrix consisting of columns with occurrences of 1s (the first column is simply a time counter). Each series of 1s without an NaN in between is an "event". Like this:
1 NaN NaN NaN2 NaN NaN NaN3 1 NaN NaN4 1 1 NaN5 NaN NaN NaN6 NaN NaN NaN7 NaN 1 NaN8 1 1 NaN9 1 NaN 110 1 NaN 111 NaN NaN NaN12 1 1 NaN13 1 1 NaN14 NaN NaN NaN15 NaN 1 NaN16 NaN 1 1
A total of three events in column 2, four events in column 3, and two events in column 4 (again, column 1 is a time step/counter). I need to count the number of events and match them up with the respective events in the other columns. The end result should look like this:
1 NaN NaN NaN NaN2 NaN NaN NaN NaN3 1 NaN NaN 14 1 1 NaN 15 NaN NaN NaN NaN6 NaN NaN NaN NaN7 NaN 1 NaN 28 1 1 NaN 29 1 NaN 1 210 1 NaN 1 211 NaN NaN NaN NaN12 1 1 NaN 313 1 1 NaN 314 NaN NaN NaN NaN15 NaN 1 NaN 416 NaN 1 1 4
Any input appreciated! Oh, the actual matrix consists of more than 3 columns with events (for now there are 4 columns, but it will get extended to about 15 eventually).
Thanks, F
Best Answer