Index exceeds the number of array elements (0).

5 次查看(过去 30 天)
I keep getting this error:
Index exceeds the number of array elements (0).
Error in S5_HoughTransform (line 58)
X = [lines(i).point1(1);lines(i).point2(1)];

回答(1 个)

Cris LaPierre
Cris LaPierre 2022-6-25
You are trying to index a variable that has no elements.
a = []
a = []
a(1)
Index exceeds the number of array elements. Index must not exceed 0.
  2 个评论
Mohamed Kammoun
Mohamed Kammoun 2022-6-30
thank you very much for your answer.
i think my problem is in:
lines=houghlines(g,theta,rho,peaks);
for some reason it returns the value of 0.
Cris LaPierre
Cris LaPierre 2022-6-30
Could be. It may be because no edges were found in your image, so g is empty.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by