while 1 A=zeros(3); % A=zeros(4); sl_br=round(8*rand+1); % sl_br=round(15*rand+1); A(sl_br)=1; [x y]=find(A==1); eukl_dist=sqrt(abs(x-1).^2+abs(y-1).^2); cityblock_dist=abs(x-1)+abs(y-1); iptsetpref('imviewinitialmagnification',100) %,'InitialMagnification','fit') imshow(A) pause(0.1) end