I am writing a program in which at some point a graph is plotted and displayed on screen. The user then needs to press \'y\' or \'n\' to accept or reject the graph. My current s
Why not using waitforbuttonpress instead?
waitforbuttonpress
Documentation: http://www.mathworks.fr/help/techdoc/ref/waitforbuttonpress.html