2%> Return a scalar MATLAB logical that is ``
true``
if the
3%> user response to a question on the MATLAB command prompt
4%> is ``Y`` or ``y``, representing YES, otherwise ``
false``
5%>
if the user response is ``N`` or ``n``.
8%> This function continues asking the input question
for as
long as
9%> the user response is not among the accepted answers mentioned above.
11%> \param[in] question : The input scalar MATLAB
string containing the
12%> question to be displayed on the MATLAB prompt.<br>
13%> (**optional**,
default = ``
""``)
16%> ``itis`` : The output scalar MATLAB logical that is ``
true``
if the
17%> user response to a question on the MATLAB command prompt
18%> is ``Y`` or ``y``, representing YES, otherwise `
false`
19%>
if the user response is ``N`` or ``n``.<br>
25%> pm.io.isyes(question)
32%> \JoshuaOsborne, May 21 2024, 6:00 PM, University of Texas at Arlington<br>
33%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
34%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
39 msg = string(question);
42 % WARNING: MATLAB 2018a compatibility:
do NOT convert the arguments to `input()` to
string. Arguments must be chars.
43 answer = lower(
string(input(msg{:},
's')));
44 if strcmp(answer,
"y")
47 elseif strcmp(answer, "n")
51 disp("Invalid answer. Please enter either y or n, then press enter.");
function isyes(in question)
Return a scalar MATLAB logical that is true if the user response to a question on the MATLAB command ...