I am woring on a for loop to extract selected datas from matlab workspace.The program has some problem to give you an idea what it all about. I want to read 12 datas which follow some pattern in my case every 10 datas that follow a criteria 20 first and then 2 read the 10 datas that follow and 2 and 20 also,these numbers and the data are infinitely many.
so I wrote a code
j=1; i=1; N=length(B); % B is the one dimensional vector which has the %whole datas for i=1:1:N if ((B(i)==20) && (B(i+1)==2)) c(j)=i; j=j+1; end end M=length(b); k=1; s=1; D=ones(12,1); for k=1:1:M l=c(k); for s=1:1:12 D(s)=B(l); l = (l+1); end end
now what I want as input for another code is D but what the code reads is like
the first value and after the next iteration the first and the second value and it coninues reading like this. So I would like some idea how to read the 10 data's that follow 20&10 every time and allocate the values to D.