Logically, of course! Matlab has the ability to compress 8 elements into 1 byte. (Regardless of whether he does it or not, another thing).
a=ones(1000); b=(a==1); tic;for(k=1:100)for(i=1:1000);for(j=1:1000);a(i,j)=a(i,j);end;end;end;toc tic;for(k=1:100)for(i=1:1000);for(j=1:1000);b(i,j)=b(i,j);end;end;end;toc
result
4.561173 seconds 3.454697 seconds
but the advantage will be much greater if you do more logical operations, and not just a loop!
Sanjay manohar
source share