use for loop

1 visualización (últimos 30 días)
Pan
Pan el 6 de Mayo de 2012
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.

Respuestas (1)

Wayne King
Wayne King el 6 de Mayo de 2012
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 comentarios
Pan
Pan el 6 de Mayo de 2012
the error is
Error in ==> bookentropy at 110
imshow(uint8(xy(:,:,:,jjj)))
Image Analyst
Image Analyst el 6 de Mayo de 2012
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by