I am creating a matrix of ones
I = binornd(1,a,T(j),n);
What i need to find next is the durations between the 1 values for each column, that is to say that for each column i will need a vector with the durations between values of 1 in the columns of the matrix.
the duration is simply the difference between the occurences, so for example if there is a 1 in (1,1) of the matrix and (3,1). Then the first number in the duration vector would be 3-1=2
Thanks! I am trying to avoid doing a for loop on this (in part because i want to get better at avoiding them in general!)
Best Answer