x=[1 0 1 4 8 4 3 5 9 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 2 4 4 4 4 0 0 0 0 0 0 0 0 0 3 5 6 3 0 0 0 0 4 4 4 0 0 0 0 5 4 1 0 0 0 0 0 4 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 ]
how can i find the start and end index of sequence of zeros if the length more than 10?
x=[1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 2 0 0 0 1 1 0 0 0 0 4 4 ];c=0;k=0;z=0;for i=1:length(x); if x(i)==0; c=c+1; else k=k+x(i); if c>10; disp(c); disp('hole'); else c=0; end end end
Best Answer