Code covered by the BSD License  

Highlights from
YESNO

5.0

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

YESNO

by

 

28 Apr 2008 (Updated )

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

Getkey inspired this file.

MATLAB release MATLAB 6.5 (R13)
Other requirements should work on most ML releases
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
20 Dec 2008 alain boyer  
20 Dec 2008 V. Poor  

Contact us