For Loop issue in code
    조회 수: 8 (최근 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에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

