waitforbuttonpress

Pauses the GUI until a mouse button/key is pressed in the current window.

Syntax

R = waitforbuttonpress

Outputs

R
0 is returned if a mouse button is pressed and 1 is returned if a key is pressed.

Example

In the following example, waitmousepos is used to inspect the

cla;
x=[0:0.15:2*pi];
y=x;
z=sin(x')*cos(y);
contour3(z);
colorbar;
disp('Starting [waitforbuttonpress], GUI will be paused and the plot can be zoomed into.');
disp('To resume, mouse click on figure, press stop button or type Control+C in command window')
waitforbuttonpress;
disp('Ended [waitforbuttonpress]')

Comments

The GUI is paused until a mouse is clicked or key is pressed in the current figure, a stop button or control + C key is pressed in the command window.