MATLAB: Pause program and await keypress

后端 未结 6 1817
旧巷少年郎
旧巷少年郎 2021-02-09 07:11

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

6条回答
  •  独厮守ぢ
    2021-02-09 07:42

    The waitforbuttonpress command is good but is triggered by either a mouse click or a key press. If you want it to trigger only from a key press, you can use the following hack:

    while ~waitforbuttonpress
    end
    

提交回复
热议问题