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