Error using sub2ind and error in imline/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
採用された回答
その他の回答 (1 件)
Guillaume
2015 年 7 月 21 日
0 投票
The error message is indeed not very helpful, but the error is simply due to the fact that one or both endpoints of your line generated by imline are outside the boundaries of the image.
But first, fix the indenting of your file (right-click in the editor and select smart indent or just press CTRL+I). Once you've done that it'll be fairly obvious that your hline = imline(... and subsequent lines should be inside the for nn = ... loop. (or you've got a major conceptual failure in your code as, as it is, only the x1, x2, index1, etc. of the last iteration of the three loop will be used).
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!