Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
Lidank Abiel
Lidank Abiel 2012 年 11 月 22 日
I get this error with matlab: "Subscript indices must either be real positive integers or logicals."
I can't understand why
the picture i use : href="http://www.freeimagehosting.net/5byoo"<img src="http://www.freeimagehosting.net/t/5byoo.jpg"></a>
x = imread('eye.jpg'); abu = rgb2gray(x); x2 = double(abu); thres_new = 150; thres = 0; [r c] = size(x2); while (thres ~= thres_new) m1=0; m2=0; thres = thres_new; for i=1:r for i=1:c if(x2(i,j) >= thres) m1=m1+x2(i,j); else m2=m2+x2(i,j); end end end [x y] = size(find(x2 >= thres)); m1_len = x; [x y] = size(find(x2 < thres)); m2_len = x; avg = ((m1/m1_len) + (m2/m2_len))/2; thres_new = avg; end
  1 件のコメント
Jan
Jan 2012 年 11 月 22 日
Please format your code properly. Currently it is not readable. When you search for it, you will find the corresponding instructions fast.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by