use for loop
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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 个评论
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 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!