MATLAB: Hi i am getting Index out of bounds error pls help me solve it

out of bounds

I hv a 2d image of 93×58 pixels. Error im gettin is attempted to access b(1,59) because size(b)=(93,58).
How do i go about rectifying this error?? Pls help as im new to matlab and to image processing. Thanks in advance.

Best Answer

You’re asking for column 59 of a 58-column matrix.
Think about it ...
EDIT Seeing only the part of your code that you posted (about 8 hours ago), I would simply reverse the values of ‘m2’ and ‘n2’ in your loops.