MATLAB: Sub2ind -> out of range subscript

fingerprintsub2ind

Hi ! I am a student and my project is about fingerprint analysis and minutia recognition. First, I have to understand each lines of the program sent by Florence Kussener : http://www.mathworks.com/matlabcentral/fileexchange/16728-fingerprint-application This application works great with the joined picture but when I download a new one, the program crashes with this error :
??? Error using ==> sub2ind at 58 Out of range subscript.
Do you have an idea ? The botch pictures are square and gray scale…I don't find the problem
Regards
PS : I am French and I my English is poor, sorry for that. And if you can answer me, please, I have to understand you so use a basic English

Best Answer

Thanks for your fast answer. It seems that with a square matrix the problem is solved (but I don't understand why). Unfortunately, some lines later a new problem :
??? Subscripted assignment dimension mismatch. Error in ==> fingerprint at 124 OrientationTerm(ind,1)=Table(i,j);
for ind=1:length(CentroidTermX) Klocal=K(CentroidTermY(ind)-2:CentroidTermY(ind)+2,CentroidTermX(ind)-2:CentroidTermX(ind)+2); Klocal(2:end-1,2:end-1)=0; [i,j]=find(Klocal); recherche des pixels (à l'intérieur de la fenêtre) à 1 restants OrientationTerm(ind,1)=Table(i,j); end
Do you know the source of the problem ?