Hi, I have a matrix looks like the attached file. As you can see, it is 219*6 matrix and only contains 1 and 0. The data shows the location of an object in timestamps. The 6 columns represents 6 locations and rows represents the time. For example, when t=10, the subject is hitting location 2, so we have example(10,2)=1. When t=9, the object is hitting location 1, so we have example(9,1)=1...What I would like to achieve is to record the time span that the object is change from one location to another location. As there are 6 locations, so we have 15 ways of path, i.e., 1 to 2, 1 to 3, 2 to 3.... For example, From t=1 to t=81, the object is moving between location 1 and 2. so we have D12(1)=81.
Could you offer some advice about how to do this in general by coding? At the moment, I am just using my eyes and counting...This is clearly not the most efficient way.
Thank you, Xueqi