12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

waitforbuttonpressPurpose2waitforbuttonpressWait for key or mouse button pressSyntaxDescriptionk = waitforbuttonpressk = waitforbuttonpress blocks the caller’s execution stream until thefunction detects that the user has pressed a mouse button or a key while thefigure window is active. The function returns• 0 if it detects a mouse button press• 1 if it detects a key pressAdditional information about the event that causes execution to resume isavailable through the figure’s CurrentCharacter, SelectionType, andCurrentPoint properties.If a WindowButtonDownFcn is defined for the figure, its callback is executedbefore waitforbuttonpress returns a value.ExampleThese statements display text in the Command Window when the user eitherclicks a mouse button or types a key in the figure window:w = waitforbuttonpress;if w == 0disp('Button press')elsedisp('Key press')endSee Alsodragrect, figure, gcf, ginput, rbbox, waitfor2-584

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!