Code covered by the BSD License  

Highlights from
YESNO

5.0

5.0 | 2 ratings Rate this file 1 Download (last 30 days) File Size: 1.65 KB File ID: #19740

YESNO

by Jos (10584)

 

28 Apr 2008 (Updated 29 Apr 2008)

let user choose between yes or no

| Watch this File

File Information
Description

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.
 
Example:
    fprintf('\nHere is a number for you: %5.0f', 1000*rand)
    while(1)
        fprintf('\nDo you want another number (y/n)? ') ;
        if yesno, fprintf(' %5.0f', 1000*rand) ;
        else fprintf('\nBye!\n') ;
                  break
        end
    end

version 1.0 april 2008

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
getkey

MATLAB release MATLAB 6.5 (R13)
Other requirements should work on most ML releases
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
20 Dec 2008 V. Poor  
20 Dec 2008 alain boyer  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
yes Jos (10584) 23 Oct 2008 06:19:14
no Jos (10584) 23 Oct 2008 06:19:14
question Jos (10584) 23 Oct 2008 06:19:14
key Jos (10584) 23 Oct 2008 06:19:14
input Jos (10584) 23 Oct 2008 06:19:14
choice Jos (10584) 23 Oct 2008 06:19:14
select Jos (10584) 23 Oct 2008 06:19:14
answer Jos (10584) 23 Oct 2008 06:19:14
gui Jos (10584) 23 Oct 2008 06:19:14

Contact us at files@mathworks.com