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),
If I understand you correctly it is very simple:
p1=sum(u)./numel(u); % is the percentage of ones p2=1-p1; % is the percentage of zeros
Matlab has even this spesific function called tabulate that creates a frequency table just for that:
tabulate(u) Value Count Percent 0 13 52.00% 1 12 48.00%