A)
ix=([logical(0);(diff(A(1:N))~=0)]);
L(find(id))=A(id);
locais=L(2:end);
I've got a meeting...gotta' run for now, sorry...
Undoubtedly can vectorize remaining fairly much, too.
One thing is it doesn't appear the for k=1:j B(k)=locais(k)'; end B=B(:);
loop does anything that
B=locais;
doesn't other than perhaps the column/vector orientation. I'd say create B to begin with and fix the orientation there as wanted/needed...
Best Answer