
Lengths of Continuous Line/Vector
Posted:
Jan 6, 2013 1:18 PM


Let us define vector y = [0 0 0 1 1 1 1 0 0 0 1 1 0] I would like to extract the length of the continuous line (i.e: ones = [4,2], zeros = [3,3,1]) I tried y(1:end1)>y(2:end) and y(1:end1)<y(2:end) but in case y start in ones or in case y(1) ~= y(end) it make me a lot of problem.
Is there a better way to extract those lengths?

