For Loop issue in code
2 次查看(过去 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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!