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!