Home > matutils > query.m

query

PURPOSE ^

function q=query

SYNOPSIS ^

function q=query

DESCRIPTION ^

 function q=query

 query function.  prompts for Y/N

 Y - returns  1
 N - returns 0

 Michael Loh

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function q=query
0002 
0003 % function q=query
0004 %
0005 % query function.  prompts for Y/N
0006 %
0007 % Y - returns  1
0008 % N - returns 0
0009 %
0010 % Michael Loh
0011 
0012 while(~exist('q'))
0013   str=input('(Y/N) ','s');
0014   str=upper(str);
0015   if (strcmp(str,'Y'))
0016     q=1;
0017   elseif (strcmp(str,'N'))
0018     q=0;
0019   else
0020     disp('Unknown command.  Try again');
0021   end
0022 end

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005