get_yes_or_no
版本 1.1.0.0 (1.8 KB) 作者:
Phillip M. Feldman
Prompt user to provide a yes-or-no answer, with an optional default value.
get_yes_or_no(prompt,default) displays a prompt and reads a response from standard input. If the response is 'y', 'yes', 'Y', or "yes", a value of 1 is returned. If the response is 'n', 'no', 'N', or 'NO', a value of 0 is returned. If the user types 'quit' or 'exit', the program is stopped. If the user does not provide input and the optional default argument is present, the default value is returned. If none of these conditions is satisfied, an error message is generated and the prompt is displayed again.
引用格式
Phillip M. Feldman (2026). get_yes_or_no (https://ww2.mathworks.cn/matlabcentral/fileexchange/24037-get_yes_or_no), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2009a
兼容任何版本
平台兼容性
Windows macOS Linux类别
在 Help Center 和 MATLAB Answers 中查找有关 Low-Level File I/O 的更多信息
