File Exchange

image thumbnail


version (1.65 KB) by Jos (10584)
let user choose between yes or no

1 Download

Updated 29 Apr 2008

View License

YESNO - returns true for y-key, false for n-key

ISYES = YESNO waits for a keypress of either the Y-key or N-key and returns a logical one (true) if the Y-key was pressed, and a logical zero (false) if the N-key was pressed.

fprintf('\nHere is a number for you: %5.0f', 1000*rand)
fprintf('\nDo you want another number (y/n)? ') ;
if yesno, fprintf(' %5.0f', 1000*rand) ;
else fprintf('\nBye!\n') ;

version 1.0 april 2008

Cite As

Jos (10584) (2021). YESNO (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

alain boyer

V. Poor

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: getkey

Inspired: Islanding Detection In Distributed Generation

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!