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
I'd use the input function:
input
a = input('Accept this graph (y/n)? ','s') if strcmpi(a,'y') ... else ... end
Although admittedly it requires two keypresses (y then Enter) rather the one.