MATLAB: Error using sub2ind and error in imline/createMask

errorImage Processing Toolboximline.createmask

Hi, while working with the below script I keep getting error message: Error using sub2ind (line 52) Out of range subscript. Error in imline/createMask (line 171) ind = sub2ind([m n], y, x); please can anyone help me with these error messages

Best Answer

  • sub2ind() does not appear in your attached code. So all I can suggest is that either m (the row) is greater than y (the number of rows), or n (the column) is greater than x (the total number of columns).
    Another common problem is mixing up row,column with x,y.