Index exceeds the number of array elements
이전 댓글 표시
Hello, matlab shows me this problem:
Index exceeds the number of array elements (495).
Error in Untitled22222 (line 34)
if suma(i)== 0
I mean exactly this loop, I got a little lost and I don't know what to do next.
while 1
if suma(i)== 0
p_kolumna=i;
break;
end
i=i+1;
end
Thank you for your help
댓글 수: 10
KSSV
2021년 11월 12일
What is suma function?
Awais Saeed
2021년 11월 12일
It seems that your condidtion did not meet because of which while loop still runs with an increment of i and i becomes greater than the largest index available.
Blazej Staniak
2021년 11월 12일
Awais Saeed
2021년 11월 12일
if summa(i) is something like 0.000000000000456, the condition will never meet. Use
format long
to see the output
Blazej Staniak
2021년 11월 12일
Awais Saeed
2021년 11월 12일
what do you mean by the same problem?
Blazej Staniak
2021년 11월 12일
KSSV
2021년 11월 12일
You should share complete code to get help. The variables are not know in the given snippet.
KSSV
2021년 11월 12일
What is size of the imahe im1.
im1 = imread('Audi_1.jpg');
Blazej Staniak
2021년 11월 12일
답변 (2개)
KSSV
2021년 11월 12일
Replace the while loop condition:
while 1
with
while i<=length(suma)
It eill not give the error..but still I am surprised what for this while loop is.
댓글 수: 4
Blazej Staniak
2021년 11월 12일
KSSV
2021년 11월 12일
It is becuase p_kolumna is not defined....the suma(i) was never equal to zero. You are missing some logic in your problem.
Blazej Staniak
2021년 11월 12일
KSSV
2021년 11월 15일
It is defined... But in the while loop suma will never be zero and it will never take the defined value. What is your problem exactly?
Blazej Staniak
2021년 11월 15일
편집: Blazej Staniak
2021년 11월 15일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!