Exit while loop and close screens after 10 mouse presses
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Katerina Tetzloff
el 23 de Oct. de 2015
Comentada: Walter Roberson
el 24 de Oct. de 2015
I am using Psychtoolbox to design a fake experiment. I have all of the code correct, but I can't get it to close after 10 mouse clicks. I tried to start the whole thing with for i=1:10, with the actual code in a while loop under this for loop, but I don't know how to relate i with number of mouse clicks.
Thank you!
1 comentario
Respuesta aceptada
Stalin Samuel
el 24 de Oct. de 2015
i = 0;
f = figure;
while i<11
w = waitforbuttonpress;
if w == 0
i =i+1;
if i ==10
close all;
break;
end
end
end
3 comentarios
Walter Roberson
el 24 de Oct. de 2015
Then you can just use a for loop, since only one click will be registered for each iteration of the loop.
Más respuestas (0)
Ver también
Categorías
Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!