For Loop issue in code
1 view (last 30 days)
Show older comments
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 Comments
Image Analyst
on 22 Mar 2015
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???
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!