use for loop

조회 수: 1 (최근 30일)
Pan
Pan 2012년 5월 6일
I want to use "For loop".
Current, I set up a matrix(idx=zeros(1,10);),then the matrix have 10 values.
I want to use the "For Loop" catch the 10 values this is my current code
iii=1;
for iii=1:idx(ik) %iend
iframe(iii)=idx;
iii=iii+1;
for jjj= idx(iii):idx(iii+1)
imshow(uint8(xy(:,:,:,iii)))
end
end
please tell me what is error.

답변 (1개)

Wayne King
Wayne King 2012년 5월 6일
Please format your code and show your erros. What are you trying to do with your loop, just display slices of your image set?
Why not just:
for iii = 1:10 %or however many slices there are
imshow(uint8(xy(:,:,:,iii)));
pause(0.5);
end
  댓글 수: 2
Pan
Pan 2012년 5월 6일
the error is
Error in ==> bookentropy at 110
imshow(uint8(xy(:,:,:,jjj)))
Image Analyst
Image Analyst 2012년 5월 6일
Well which is it: iii or jjj? Regardless, learn to use the debugger (so you can solve things quickly without waiting on us), set a breakpoint on the imshow() line, and then do this in the command window:
iii
jjj
size(xy)
min(xy(:))
max(xy(:))
Then, if you can't figure out what's wrong, come back here for help.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by