Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
I got subscript indices must be real positive integers or logicals on my code
조회 수: 1 (최근 30일)
이전 댓글 표시
Im trying to equalized my picture with this loop
for baris = 1 : jum_baris
for kolom = 1 : jum_kolom
Hasil(baris, kolom) = C(img(baris, kolom)); %this line got me that error
end
end
Hasil = uint8(Hasil);
댓글 수: 1
Tommy
2020년 4월 5일
What is C? It is likely that
img(baris, kolom)
is the culprit. If C is a matrix, the above statement should return a real positive integer or logical.
답변 (2개)
drummer
2020년 4월 5일
What is C?
I suppose your original image to be equalized is img. So is C any function applied in img?
If that's not the case, your just playing with the indexes.
Previously to your code, you can say the height and width of img.
[jum_baris, jum_kolon] = size(img);
That way, jum_baris and jum_kolom will be integers and positives. if you're taking them elsewhere, and they have decimal places, using them as indexes for matrix won't work.
yourNewMatrix(1.3, 1.12) % is not possible.
If they go randomly between positive and negative numbers, they won't work as well
yourMatrix(1,-2) % is not possible as well.
Cheers
댓글 수: 0
Image Analyst
2020년 4월 5일
This is a FAQ (possibly the most F or the error message questions), so see the FAQ:
It has a pretty thorough discussion.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!