MATLAB: Function error while using sb2ind function

fingerprint

there is an errror in sub2ind function when i type the following: indTerm=sub2ind([m,n],CentroidTerm(:,1),CentroidTerm(:,2));
it says that "out of range subscript"
plz tell me what is the problem. }

Best Answer

conditions to work correctly
isequal(~rem(CentroidTerm,1),bsxfun(@ge,CentroidTerm ,[1 1]),bsxfun(@le,CentroidTerm ,[m n]))