I\'ve already have my vector and number of zeros and ones with this code:
u=[1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0] transitions=(find(u~=[u(2:end),
This is just psuedocode so it'll need to be translated, but here's a potential solution:
total = 0; total_ones = 0; total_zeroes = 0; for(i=0; i