function [A,readOrder]=getPictureOrder(numPictureX,startImage)
% numPictureX = 11;
% startImage = 6;
numPictureTotal = numPictureX^2;
A=zeros(numPictureX,numPictureX);

ind1 = numPictureTotal;
ind2 = ind1-numPictureX+1;
A(1,:)=linspace(ind1,ind2,numPictureX);

j=2;
for p=1:(numPictureX-1)/2
    
    ind2 =ind2-1;
    ind1 =ind2-numPictureX+1;
    A(j,:)=linspace(ind1,ind2,numPictureX);
    j=j+1;
    ind1 =ind1-1;
    ind2 =ind1-numPictureX+1;
    A(j,:)=linspace(ind1,ind2,numPictureX);
    j=j+1;
    
end

A = A+startImage-1;
%A = fliplr(A);
readOrder = reshape(A',numPictureX*numPictureX,1);
