www.pudn.com > Watermark.rar > zigzag.m, change:2009-06-25,size:460b


k=1; 
B=zeros(64); 
for m=2:9 
    for n=1:(m-1) 
        if mod(m,2)==0 
            B(m-n,n)=A(k); 
            k=k+1; 
        else 
          B(n,m-n)=A(k);   
            k=k+1; 
        end 
    end 
end 
for m=(8:(-1):2) 
    for n=1:(m-1) 
        if mod(m,2)==0 
           B(9-n,9-m+n)=A(k); 
            k=k+1; 
        else 
           B(9-m+n,9-n)=A(k); 
            k=k+1; 
        end 
    end 
end 
 
 
for k=1:64 
   A(k)=k; 
end