For Loop issue in code
1 回表示 (過去 30 日間)
古いコメントを表示
Can anyone please guide in this scenario.. I have
out = [a,histc(idx(:),a)]; % out variable having cluster number and cluster size
[a,ix]= max(out(:,2)); %getting the max value in a and its index in ix variable
[row , col] = find(idx ==ix);%using find func in checking where in idx the ix exists and storing the row col index in row and col
mx_row = max(row); %getting max row index
mx_col = max(col);%getting max col index
for i = 1 : mx_row %for loop till max row index
for j = 1 : mx_col %for loop till max col index
cp = I(row(i),col(j));% getting the row and col indexes and accessing the element from I and store it in cp
end
end
There is error for loops it is not storing the values at corresponding locations! Please help
2 件のコメント
Image Analyst
2015 年 3 月 22 日
I can't tell from this snippet. What is the badly-named "a" and idx? And what's the point of computing cp? You're not even indexing it, so it's a scalar (a single number not an array) - and you're just getting it and throwing it away.
What is the overall goal of this code? To find the max intensity in an image???
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!