how to use 'for' in a nested loop and get a result quickly for example I write this code:
%%%%%%%%%%%%%%%%%%
Ac=reshape(Ac,1,[]);Ac_estm=reshape(Ac_estm,1,[]);P=size(Ac,2);T=reshape(T,1,[]);for(p=1:P) delta=d*Ac(p); if(T(p)==0) while(Ac(p)<=Ac_estm(p)-delta) Ac(p)=Ac(p)-1; end else while(Ac(p)>=Ac_estm(p)+delta) Ac(p)=Ac(p)+1; end endend
%%%%%%%%%%%%%
but the execution is very slow and stops over the counter at 9
(T is logical and length(T)>= length(Ac) and length(Ac)=length(Ac_estm))
Best Answer